diff --git a/Assets/Palettes/LevelPalette.prefab b/Assets/Palettes/LevelPalette.prefab index cf03f9b..4ec03b9 100644 --- a/Assets/Palettes/LevelPalette.prefab +++ b/Assets/Palettes/LevelPalette.prefab @@ -41,7 +41,7 @@ Grid: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 853041586611798452} m_Enabled: 1 - m_CellSize: {x: 1.0230769, y: 1.4351516, z: 0} + m_CellSize: {x: 1.0384616, y: 1.0307692, z: 0} m_CellGap: {x: 0, y: 0, z: 0} m_CellLayout: 0 m_CellSwizzle: 0 @@ -90,7 +90,7 @@ Tilemap: - first: {x: -1, y: -3, z: 0} second: serializedVersion: 2 - m_TileIndex: 9 + m_TileIndex: 8 m_TileSpriteIndex: 0 m_TileMatrixIndex: 0 m_TileColorIndex: 0 @@ -100,104 +100,24 @@ Tilemap: - first: {x: -3, y: -2, z: 0} second: serializedVersion: 2 - m_TileIndex: 16 + m_TileIndex: 14 m_TileSpriteIndex: 1 m_TileMatrixIndex: 0 m_TileColorIndex: 0 m_TileObjectToInstantiateIndex: 65535 dummyAlignment: 0 - m_AllTileFlags: 1073741825 + m_AllTileFlags: 2147483649 - first: {x: -2, y: -2, z: 0} second: serializedVersion: 2 - m_TileIndex: 12 + m_TileIndex: 10 m_TileSpriteIndex: 2 m_TileMatrixIndex: 0 m_TileColorIndex: 0 m_TileObjectToInstantiateIndex: 65535 dummyAlignment: 0 - m_AllTileFlags: 1073741825 + m_AllTileFlags: 2147483649 - first: {x: -1, y: -2, z: 0} - second: - serializedVersion: 2 - m_TileIndex: 6 - m_TileSpriteIndex: 4294967295 - m_TileMatrixIndex: 0 - m_TileColorIndex: 0 - m_TileObjectToInstantiateIndex: 65535 - dummyAlignment: 0 - m_AllTileFlags: 1073741825 - - first: {x: 0, y: -2, z: 0} - second: - serializedVersion: 2 - m_TileIndex: 7 - m_TileSpriteIndex: 4294967295 - m_TileMatrixIndex: 0 - m_TileColorIndex: 0 - m_TileObjectToInstantiateIndex: 65535 - dummyAlignment: 0 - m_AllTileFlags: 1073741825 - - first: {x: 1, y: -2, z: 0} - second: - serializedVersion: 2 - m_TileIndex: 8 - m_TileSpriteIndex: 3 - m_TileMatrixIndex: 0 - m_TileColorIndex: 0 - m_TileObjectToInstantiateIndex: 65535 - dummyAlignment: 0 - m_AllTileFlags: 1073741825 - - first: {x: 2, y: -2, z: 0} - second: - serializedVersion: 2 - m_TileIndex: 10 - m_TileSpriteIndex: 4 - m_TileMatrixIndex: 0 - m_TileColorIndex: 1 - m_TileObjectToInstantiateIndex: 65535 - dummyAlignment: 0 - m_AllTileFlags: 1073741827 - - first: {x: 4, y: -2, z: 0} - second: - serializedVersion: 2 - m_TileIndex: 15 - m_TileSpriteIndex: 5 - m_TileMatrixIndex: 0 - m_TileColorIndex: 0 - m_TileObjectToInstantiateIndex: 65535 - dummyAlignment: 0 - m_AllTileFlags: 1073741825 - - first: {x: -3, y: -1, z: 0} - second: - serializedVersion: 2 - m_TileIndex: 11 - m_TileSpriteIndex: 6 - m_TileMatrixIndex: 0 - m_TileColorIndex: 0 - m_TileObjectToInstantiateIndex: 65535 - dummyAlignment: 0 - m_AllTileFlags: 1073741825 - - first: {x: -1, y: -1, z: 0} - second: - serializedVersion: 2 - m_TileIndex: 3 - m_TileSpriteIndex: 4294967295 - m_TileMatrixIndex: 0 - m_TileColorIndex: 0 - m_TileObjectToInstantiateIndex: 65535 - dummyAlignment: 0 - m_AllTileFlags: 1073741825 - - first: {x: 0, y: -1, z: 0} - second: - serializedVersion: 2 - m_TileIndex: 4 - m_TileSpriteIndex: 4294967295 - m_TileMatrixIndex: 0 - m_TileColorIndex: 0 - m_TileObjectToInstantiateIndex: 65535 - dummyAlignment: 0 - m_AllTileFlags: 1073741825 - - first: {x: 1, y: -1, z: 0} second: serializedVersion: 2 m_TileIndex: 5 @@ -207,26 +127,106 @@ Tilemap: m_TileObjectToInstantiateIndex: 65535 dummyAlignment: 0 m_AllTileFlags: 1073741825 - - first: {x: 2, y: -1, z: 0} + - first: {x: 0, y: -2, z: 0} second: serializedVersion: 2 - m_TileIndex: 17 - m_TileSpriteIndex: 10 + m_TileIndex: 6 + m_TileSpriteIndex: 4294967295 m_TileMatrixIndex: 0 m_TileColorIndex: 0 m_TileObjectToInstantiateIndex: 65535 dummyAlignment: 0 m_AllTileFlags: 1073741825 - - first: {x: 3, y: -1, z: 0} + - first: {x: 1, y: -2, z: 0} + second: + serializedVersion: 2 + m_TileIndex: 7 + m_TileSpriteIndex: 3 + m_TileMatrixIndex: 0 + m_TileColorIndex: 0 + m_TileObjectToInstantiateIndex: 65535 + dummyAlignment: 0 + m_AllTileFlags: 1073741825 + - first: {x: 2, y: -2, z: 0} + second: + serializedVersion: 2 + m_TileIndex: 9 + m_TileSpriteIndex: 4 + m_TileMatrixIndex: 0 + m_TileColorIndex: 1 + m_TileObjectToInstantiateIndex: 65535 + dummyAlignment: 0 + m_AllTileFlags: 1073741827 + - first: {x: 4, y: -2, z: 0} second: serializedVersion: 2 m_TileIndex: 13 + m_TileSpriteIndex: 5 + m_TileMatrixIndex: 0 + m_TileColorIndex: 0 + m_TileObjectToInstantiateIndex: 65535 + dummyAlignment: 0 + m_AllTileFlags: 1073741825 + - first: {x: -3, y: -1, z: 0} + second: + serializedVersion: 2 + m_TileIndex: 3 + m_TileSpriteIndex: 6 + m_TileMatrixIndex: 0 + m_TileColorIndex: 0 + m_TileObjectToInstantiateIndex: 65535 + dummyAlignment: 0 + m_AllTileFlags: 1073741825 + - first: {x: -1, y: -1, z: 0} + second: + serializedVersion: 2 + m_TileIndex: 2 + m_TileSpriteIndex: 4294967295 + m_TileMatrixIndex: 0 + m_TileColorIndex: 0 + m_TileObjectToInstantiateIndex: 65535 + dummyAlignment: 0 + m_AllTileFlags: 1073741825 + - first: {x: 0, y: -1, z: 0} + second: + serializedVersion: 2 + m_TileIndex: 3 + m_TileSpriteIndex: 6 + m_TileMatrixIndex: 0 + m_TileColorIndex: 0 + m_TileObjectToInstantiateIndex: 65535 + dummyAlignment: 0 + m_AllTileFlags: 1073741825 + - first: {x: 1, y: -1, z: 0} + second: + serializedVersion: 2 + m_TileIndex: 4 + m_TileSpriteIndex: 4294967295 + m_TileMatrixIndex: 0 + m_TileColorIndex: 0 + m_TileObjectToInstantiateIndex: 65535 + dummyAlignment: 0 + m_AllTileFlags: 1073741825 + - first: {x: 2, y: -1, z: 0} + second: + serializedVersion: 2 + m_TileIndex: 15 m_TileSpriteIndex: 7 m_TileMatrixIndex: 0 m_TileColorIndex: 0 m_TileObjectToInstantiateIndex: 65535 dummyAlignment: 0 - m_AllTileFlags: 1073741825 + m_AllTileFlags: 2147483649 + - first: {x: 3, y: -1, z: 0} + second: + serializedVersion: 2 + m_TileIndex: 11 + m_TileSpriteIndex: 8 + m_TileMatrixIndex: 0 + m_TileColorIndex: 0 + m_TileObjectToInstantiateIndex: 65535 + dummyAlignment: 0 + m_AllTileFlags: 2147483649 - first: {x: -1, y: 0, z: 0} second: serializedVersion: 2 @@ -237,21 +237,11 @@ Tilemap: m_TileObjectToInstantiateIndex: 65535 dummyAlignment: 0 m_AllTileFlags: 1073741825 - - first: {x: 0, y: 0, z: 0} - second: - serializedVersion: 2 - m_TileIndex: 1 - m_TileSpriteIndex: 4294967295 - m_TileMatrixIndex: 0 - m_TileColorIndex: 0 - m_TileObjectToInstantiateIndex: 65535 - dummyAlignment: 0 - m_AllTileFlags: 1073741825 - first: {x: 1, y: 0, z: 0} second: serializedVersion: 2 - m_TileIndex: 2 - m_TileSpriteIndex: 8 + m_TileIndex: 1 + m_TileSpriteIndex: 9 m_TileMatrixIndex: 0 m_TileColorIndex: 0 m_TileObjectToInstantiateIndex: 65535 @@ -260,25 +250,23 @@ Tilemap: - first: {x: 3, y: 0, z: 0} second: serializedVersion: 2 - m_TileIndex: 14 - m_TileSpriteIndex: 9 + m_TileIndex: 12 + m_TileSpriteIndex: 10 m_TileMatrixIndex: 0 m_TileColorIndex: 0 m_TileObjectToInstantiateIndex: 65535 dummyAlignment: 0 - m_AllTileFlags: 1073741825 + m_AllTileFlags: 2147483649 m_AnimatedTiles: {} m_TileAssetArray: - m_RefCount: 1 m_Data: {fileID: 11400000, guid: 086479e1ce082214fa7d49a77c6cbbf8, type: 2} - - m_RefCount: 1 - m_Data: {fileID: 11400000, guid: 0279a6e99b52c3a4bb01da741ec0b2ea, type: 2} - m_RefCount: 1 m_Data: {fileID: 11400000, guid: 58a993220c4ec45469e8a1d3085a81bf, type: 2} - m_RefCount: 1 m_Data: {fileID: 11400000, guid: c25b8631200c390418aa1465b6ed050e, type: 2} - - m_RefCount: 1 - m_Data: {fileID: 11400000, guid: c334839fa25619848900bcf742b75cf5, type: 2} + - m_RefCount: 2 + m_Data: {fileID: 11400000, guid: c172c8f07ca54fc4bb68b1c1845a5789, type: 2} - m_RefCount: 1 m_Data: {fileID: 11400000, guid: 44c02ef7daffb9c48b26fdbdd9a87e19, type: 2} - m_RefCount: 1 @@ -291,8 +279,6 @@ Tilemap: m_Data: {fileID: 11400000, guid: 79238e0a148ac48418c05bc0e948a462, type: 2} - m_RefCount: 1 m_Data: {fileID: 0} - - m_RefCount: 1 - m_Data: {fileID: 11400000, guid: 54907339171673047ba183db663902df, type: 2} - m_RefCount: 1 m_Data: {fileID: 11400000, guid: bac0a27e7947ed345a6ac005a5369889, type: 2} - m_RefCount: 1 @@ -318,18 +304,18 @@ Tilemap: m_Data: {fileID: 0} - m_RefCount: 1 m_Data: {fileID: 1008980597, guid: d4db151fbe2751a408aea21a96ebdd19, type: 3} + - m_RefCount: 2 + m_Data: {fileID: 606517438, guid: 7c2d6acd22d2d0c40b84d99967afb42a, type: 3} - m_RefCount: 1 - m_Data: {fileID: 21300000, guid: 89ef4f64706367d498e9e80cd9d2819b, type: 3} + m_Data: {fileID: -974747892, guid: 7c2d6acd22d2d0c40b84d99967afb42a, type: 3} - m_RefCount: 1 m_Data: {fileID: -1127884870, guid: d4db151fbe2751a408aea21a96ebdd19, type: 3} - m_RefCount: 1 m_Data: {fileID: 21300000, guid: 0ad2983bed21bb049b065cbc6efc57e8, type: 3} - m_RefCount: 1 m_Data: {fileID: -1907729535, guid: d4db151fbe2751a408aea21a96ebdd19, type: 3} - - m_RefCount: 1 - m_Data: {fileID: -974747892, guid: 7c2d6acd22d2d0c40b84d99967afb42a, type: 3} m_TileMatrixArray: - - m_RefCount: 18 + - m_RefCount: 17 m_Data: e00: 1 e01: 0 @@ -348,10 +334,10 @@ Tilemap: e32: 0 e33: 1 m_TileColorArray: - - m_RefCount: 17 + - m_RefCount: 16 m_Data: {r: 1, g: 1, b: 1, a: 1} - m_RefCount: 1 - m_Data: {r: 0.7871933, g: 0.47979766, b: 0.5446725, a: 1} + m_Data: {r: 0.9813401, g: 0.5462021, b: 0.5945253, a: 1} m_TileObjectToInstantiateArray: [] m_AnimationFrameRate: 1 m_Color: {r: 1, g: 1, b: 1, a: 1} @@ -418,14 +404,14 @@ TilemapRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_ChunkSize: {x: 32, y: 32, z: 32} - m_ChunkCullingBounds: {x: 0.011538446, y: 0.21757579, z: 0} + m_ChunkCullingBounds: {x: 0.019230783, y: 0.0153846145, z: 0} m_MaxChunkCount: 16 m_MaxFrameAge: 16 m_SortOrder: 0 m_Mode: 0 m_DetectChunkCullingBounds: 0 m_MaskInteraction: 0 ---- !u!114 &6019155510506342490 +--- !u!114 &7081993049063785639 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index ff05ac7..8203f8e 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -348,6 +348,7 @@ GameObject: - component: {fileID: 350695917} - component: {fileID: 350695916} - component: {fileID: 350695918} + - component: {fileID: 350695919} m_Layer: 3 m_Name: Walls m_TagString: Ground @@ -1917,6 +1918,18 @@ TilemapCollider2D: m_MaximumTileChangeCount: 1000 m_ExtrusionFactor: 0.00001 m_UseDelaunayMesh: 0 +--- !u!114 &350695919 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 350695914} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3f939712c17722545b2724151dac3d9d, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &355246202 GameObject: m_ObjectHideFlags: 0 @@ -2307,7 +2320,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!114 &510997469 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2322,13 +2335,9 @@ MonoBehaviour: m_EditorClassIdentifier: animator: {fileID: 1627236053} MovementSpeed: 2 - ladderLayer: - serializedVersion: 2 - m_Bits: 64 - groundLayer: + _mapLayer: serializedVersion: 2 m_Bits: 8 - distance: 1 --- !u!61 &510997470 BoxCollider2D: m_ObjectHideFlags: 0 @@ -3089,6 +3098,7 @@ Transform: - {fileID: 679297304} - {fileID: 350695915} - {fileID: 1314998801} + - {fileID: 1409424113} - {fileID: 2012902680} - {fileID: 1322461127} m_Father: {fileID: 0} @@ -3229,7 +3239,8 @@ GameObject: - component: {fileID: 1314998804} - component: {fileID: 1314998803} - component: {fileID: 1314998802} - m_Layer: 6 + - component: {fileID: 1314998805} + m_Layer: 3 m_Name: Ladders m_TagString: Untagged m_Icon: {fileID: 0} @@ -3284,7 +3295,7 @@ TilemapCollider2D: m_UsedByEffector: 0 m_UsedByComposite: 0 m_Offset: {x: 0, y: 0} - m_MaximumTileChangeCount: 100 + m_MaximumTileChangeCount: 1000 m_ExtrusionFactor: 0.00001 m_UseDelaunayMesh: 0 --- !u!483693784 &1314998803 @@ -3505,16 +3516,6 @@ Tilemap: m_TileObjectToInstantiateIndex: 65535 dummyAlignment: 0 m_AllTileFlags: 2147483649 - - first: {x: -7, y: -1, z: 0} - second: - serializedVersion: 2 - m_TileIndex: 4 - m_TileSpriteIndex: 3 - m_TileMatrixIndex: 0 - m_TileColorIndex: 0 - m_TileObjectToInstantiateIndex: 65535 - dummyAlignment: 0 - m_AllTileFlags: 2147483649 - first: {x: -3, y: -1, z: 0} second: serializedVersion: 2 @@ -3635,7 +3636,7 @@ Tilemap: m_Data: {fileID: 0} - m_RefCount: 0 m_Data: {fileID: 0} - - m_RefCount: 28 + - m_RefCount: 27 m_Data: {fileID: 11400000, guid: a01b3ed4763b6b948ad3cc337953ba62, type: 2} - m_RefCount: 0 m_Data: {fileID: 0} @@ -3646,12 +3647,12 @@ Tilemap: m_Data: {fileID: 0} - m_RefCount: 0 m_Data: {fileID: 0} - - m_RefCount: 28 + - m_RefCount: 27 m_Data: {fileID: -974747892, guid: 7c2d6acd22d2d0c40b84d99967afb42a, type: 3} - m_RefCount: 0 m_Data: {fileID: 0} m_TileMatrixArray: - - m_RefCount: 28 + - m_RefCount: 27 m_Data: e00: 1 e01: 0 @@ -3670,7 +3671,7 @@ Tilemap: e32: 0 e33: 1 m_TileColorArray: - - m_RefCount: 28 + - m_RefCount: 27 m_Data: {r: 1, g: 1, b: 1, a: 1} m_TileObjectToInstantiateArray: [] m_AnimationFrameRate: 1 @@ -3696,6 +3697,18 @@ Tilemap: e31: 0 e32: 0 e33: 1 +--- !u!114 &1314998805 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1314998800} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8e88df5680ec8e64ea4939c37720b363, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1322461126 GameObject: m_ObjectHideFlags: 0 @@ -3775,6 +3788,258 @@ Transform: m_CorrespondingSourceObject: {fileID: 7047733282028940670, guid: 934a57b833e872445ac8463836f55a44, type: 3} m_PrefabInstance: {fileID: 1958282260} m_PrefabAsset: {fileID: 0} +--- !u!1 &1409424112 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1409424113} + - component: {fileID: 1409424116} + - component: {fileID: 1409424115} + - component: {fileID: 1409424114} + - component: {fileID: 1409424117} + m_Layer: 3 + m_Name: Bridges + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1409424113 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1409424112} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1173618893} + m_RootOrder: -1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!19719996 &1409424114 +TilemapCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1409424112} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_MaximumTileChangeCount: 1000 + m_ExtrusionFactor: 0.00001 + m_UseDelaunayMesh: 0 +--- !u!483693784 &1409424115 +TilemapRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1409424112} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: -133646357 + m_SortingLayer: 2 + m_SortingOrder: 0 + m_ChunkSize: {x: 32, y: 32, z: 32} + m_ChunkCullingBounds: {x: 0.019230783, y: 0, z: 0} + m_MaxChunkCount: 16 + m_MaxFrameAge: 16 + m_SortOrder: 0 + m_Mode: 0 + m_DetectChunkCullingBounds: 0 + m_MaskInteraction: 0 +--- !u!1839735485 &1409424116 +Tilemap: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1409424112} + m_Enabled: 1 + m_Tiles: + - first: {x: -2, y: -4, z: 0} + second: + serializedVersion: 2 + m_TileIndex: 5 + m_TileSpriteIndex: 4 + m_TileMatrixIndex: 0 + m_TileColorIndex: 0 + m_TileObjectToInstantiateIndex: 65535 + dummyAlignment: 0 + m_AllTileFlags: 2147483649 + - first: {x: -1, y: -4, z: 0} + second: + serializedVersion: 2 + m_TileIndex: 5 + m_TileSpriteIndex: 4 + m_TileMatrixIndex: 0 + m_TileColorIndex: 0 + m_TileObjectToInstantiateIndex: 65535 + dummyAlignment: 0 + m_AllTileFlags: 2147483649 + - first: {x: 0, y: -4, z: 0} + second: + serializedVersion: 2 + m_TileIndex: 5 + m_TileSpriteIndex: 4 + m_TileMatrixIndex: 0 + m_TileColorIndex: 0 + m_TileObjectToInstantiateIndex: 65535 + dummyAlignment: 0 + m_AllTileFlags: 2147483649 + - first: {x: -9, y: -1, z: 0} + second: + serializedVersion: 2 + m_TileIndex: 5 + m_TileSpriteIndex: 4 + m_TileMatrixIndex: 0 + m_TileColorIndex: 0 + m_TileObjectToInstantiateIndex: 65535 + dummyAlignment: 0 + m_AllTileFlags: 2147483649 + m_AnimatedTiles: {} + m_TileAssetArray: + - m_RefCount: 0 + m_Data: {fileID: 0} + - m_RefCount: 0 + m_Data: {fileID: 0} + - m_RefCount: 0 + m_Data: {fileID: 0} + - m_RefCount: 0 + m_Data: {fileID: 0} + - m_RefCount: 0 + m_Data: {fileID: 0} + - m_RefCount: 4 + m_Data: {fileID: 11400000, guid: c172c8f07ca54fc4bb68b1c1845a5789, type: 2} + m_TileSpriteArray: + - m_RefCount: 0 + m_Data: {fileID: 0} + - m_RefCount: 0 + m_Data: {fileID: 0} + - m_RefCount: 0 + m_Data: {fileID: 0} + - m_RefCount: 0 + m_Data: {fileID: 0} + - m_RefCount: 4 + m_Data: {fileID: 606517438, guid: 7c2d6acd22d2d0c40b84d99967afb42a, type: 3} + m_TileMatrixArray: + - m_RefCount: 4 + m_Data: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_TileColorArray: + - m_RefCount: 4 + m_Data: {r: 1, g: 1, b: 1, a: 1} + m_TileObjectToInstantiateArray: [] + m_AnimationFrameRate: 1 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Origin: {x: -11, y: -10, z: 0} + m_Size: {x: 28, y: 19, z: 1} + m_TileAnchor: {x: 0.5, y: 0.5, z: 0} + m_TileOrientation: 0 + m_TileOrientationMatrix: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 +--- !u!114 &1409424117 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1409424112} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7710dbd5e4ddd064198582aed7ee50c0, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!4 &1452555524 stripped Transform: m_CorrespondingSourceObject: {fileID: 7047733282028940670, guid: 934a57b833e872445ac8463836f55a44, type: 3} @@ -3910,13 +4175,9 @@ MonoBehaviour: m_EditorClassIdentifier: animator: {fileID: 1627236053} MovementSpeed: 2.5 - ladderLayer: - serializedVersion: 2 - m_Bits: 64 - groundLayer: + _mapLayer: serializedVersion: 2 m_Bits: 8 - distance: 1 --- !u!61 &1627236055 BoxCollider2D: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Character.cs b/Assets/Scripts/Character.cs index 843ad4c..fc5d394 100644 --- a/Assets/Scripts/Character.cs +++ b/Assets/Scripts/Character.cs @@ -7,15 +7,15 @@ public class Character : MonoBehaviour [SerializeField] private float MovementSpeed = 1.5f; [SerializeField] - private LayerMask ladderLayer; - [SerializeField] - private LayerMask groundLayer; - [SerializeField] - private float distance; - private bool _isOnLadder; + private LayerMask _mapLayer; + + private Rigidbody2D _body; private BoxCollider2D _boxCollider; - private bool _isFall; + + private bool _isOnBridge; + private bool _isOnLadder; + private bool _isFalling; private bool _facingRight = true; @@ -31,20 +31,22 @@ public class Character : MonoBehaviour protected void MoveTo(float inputHorizontal,float inputVertical) { - var groundCheck = CheckBounds(Vector2.down, groundLayer); - - float v_movement=0; - if (groundCheck || _isOnLadder) + var mapElement = GetMapElement(Vector2.down); + + _isOnBridge = mapElement == MapElementType.Bridge && !_isFalling; + + float v_movement=0; + if (mapElement==MapElementType.Wall || _isOnLadder || _isOnBridge) { - var leftCheck = CheckBounds(Vector2.left, groundLayer); - var rightCheck = CheckBounds(Vector2.right, groundLayer); - if(leftCheck.collider!=null) { + var leftCheck = GetMapElement(Vector2.left); + var rightCheck = GetMapElement(Vector2.right); + if(leftCheck == MapElementType.Wall) { isAllowLeft = false; }else { isAllowLeft = true; } - if (rightCheck.collider != null) { + if (rightCheck ==MapElementType.Wall) { isAllowRight = false; }else { @@ -52,7 +54,7 @@ public class Character : MonoBehaviour } isAllowVertical = false; - _isFall = false; + _isFalling = false; float h_movement = inputHorizontal; if (h_movement > 0 && !_facingRight) { @@ -65,52 +67,56 @@ public class Character : MonoBehaviour animator.SetBool("Walk", h_movement != 0); - if (CheckBounds(Vector2.down, ladderLayer)) + _isOnLadder = mapElement == MapElementType.Ladder || GetMapElement(Vector2.up) == MapElementType.Ladder; + if (_isOnLadder) { isAllowVertical = true; _isOnLadder = true; - v_movement=inputVertical; + v_movement = inputVertical; if (v_movement > 0) { - if (!CheckBounds(Vector2.up,ladderLayer)) + if (GetMapElement(Vector2.up) != MapElementType.Ladder) { v_movement = 0; } } } - else - { - _isOnLadder = false; - } _body.velocity = new Vector2(h_movement * MovementSpeed, v_movement * MovementSpeed); } else { - _isFall = true; + _isFalling = true; } } - private RaycastHit2D CheckBounds(Vector2 direction,LayerMask layer) + private MapElementType GetMapElement(Vector2 direction) { - return Physics2D.BoxCast(_boxCollider.bounds.center, _boxCollider.bounds.size, 0f, direction, .1f, layer); + var raycastHit=Physics2D.BoxCast(_boxCollider.bounds.center, _boxCollider.bounds.size, 0f, direction, .1f, _mapLayer); + if (raycastHit) + { + var mapElement = raycastHit.transform.GetComponent(); + + return mapElement == null ? MapElementType.Empty : mapElement.ElementType; + } + else + return MapElementType.Empty; } private void FixedUpdate() { - if (_isOnLadder) + if (_isOnLadder|| _isOnBridge) { - _body.gravityScale = 0; } else { _body.gravityScale = 1; } - if (_isFall) + if (_isFalling) { - if (CheckBounds(Vector2.down,ladderLayer)) + if (GetMapElement(Vector2.down)==MapElementType.Ladder) { _isOnLadder = true; } diff --git a/Assets/Scripts/Enums.cs b/Assets/Scripts/Enums.cs index 813e80b..ffd98ee 100644 --- a/Assets/Scripts/Enums.cs +++ b/Assets/Scripts/Enums.cs @@ -1 +1,2 @@ public enum TreasureType { Coin, Key } +public enum MapElementType {Empty,Wall,Ladder,Bridge } \ No newline at end of file diff --git a/Assets/Scripts/MapElements.meta b/Assets/Scripts/MapElements.meta new file mode 100644 index 0000000..6732ab7 --- /dev/null +++ b/Assets/Scripts/MapElements.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f7c871dd492d04149b39713e47b77dc6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MapElements/Bridge.cs b/Assets/Scripts/MapElements/Bridge.cs new file mode 100644 index 0000000..d720a8e --- /dev/null +++ b/Assets/Scripts/MapElements/Bridge.cs @@ -0,0 +1,6 @@ +using UnityEngine; + +public class Bridge : MonoBehaviour, IMapElement +{ + public MapElementType ElementType => MapElementType.Bridge; +} diff --git a/Assets/Scripts/MapElements/Bridge.cs.meta b/Assets/Scripts/MapElements/Bridge.cs.meta new file mode 100644 index 0000000..62ba33c --- /dev/null +++ b/Assets/Scripts/MapElements/Bridge.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7710dbd5e4ddd064198582aed7ee50c0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MapElements/IMapElement.cs b/Assets/Scripts/MapElements/IMapElement.cs new file mode 100644 index 0000000..d852e65 --- /dev/null +++ b/Assets/Scripts/MapElements/IMapElement.cs @@ -0,0 +1,4 @@ +public interface IMapElement +{ + MapElementType ElementType { get; } +} diff --git a/Assets/Scripts/MapElements/IMapElement.cs.meta b/Assets/Scripts/MapElements/IMapElement.cs.meta new file mode 100644 index 0000000..d5a2450 --- /dev/null +++ b/Assets/Scripts/MapElements/IMapElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: edf40d39eadb17a4ebb0368b3ac5399a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MapElements/Ladder.cs b/Assets/Scripts/MapElements/Ladder.cs new file mode 100644 index 0000000..30e12ef --- /dev/null +++ b/Assets/Scripts/MapElements/Ladder.cs @@ -0,0 +1,6 @@ +using UnityEngine; + +public class Ladder : MonoBehaviour, IMapElement +{ + public MapElementType ElementType => MapElementType.Ladder; +} diff --git a/Assets/Scripts/MapElements/Ladder.cs.meta b/Assets/Scripts/MapElements/Ladder.cs.meta new file mode 100644 index 0000000..0ce19f3 --- /dev/null +++ b/Assets/Scripts/MapElements/Ladder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8e88df5680ec8e64ea4939c37720b363 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MapElements/Wall.cs b/Assets/Scripts/MapElements/Wall.cs new file mode 100644 index 0000000..aa93012 --- /dev/null +++ b/Assets/Scripts/MapElements/Wall.cs @@ -0,0 +1,6 @@ +using UnityEngine; + +public class Wall : MonoBehaviour, IMapElement +{ + public MapElementType ElementType => MapElementType.Wall; +} diff --git a/Assets/Scripts/MapElements/Wall.cs.meta b/Assets/Scripts/MapElements/Wall.cs.meta new file mode 100644 index 0000000..88bf2b5 --- /dev/null +++ b/Assets/Scripts/MapElements/Wall.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3f939712c17722545b2724151dac3d9d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sprites/Tileset.png.meta b/Assets/Sprites/Tileset.png.meta index 73d740b..abd576b 100644 --- a/Assets/Sprites/Tileset.png.meta +++ b/Assets/Sprites/Tileset.png.meta @@ -156,9 +156,9 @@ TextureImporter: rect: serializedVersion: 2 x: 371 - y: 280 + y: 172 width: 135 - height: 23 + height: 130 alignment: 0 pivot: {x: 0.5, y: 0.5} border: {x: 0, y: 0, z: 0, w: 0} diff --git a/Assets/Sprites/Tileset_2.asset b/Assets/Sprites/Tileset_2.asset new file mode 100644 index 0000000..266cdd8 --- /dev/null +++ b/Assets/Sprites/Tileset_2.asset @@ -0,0 +1,36 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 13312, guid: 0000000000000000e000000000000000, type: 0} + m_Name: Tileset_2 + m_EditorClassIdentifier: + m_Sprite: {fileID: 606517438, guid: 7c2d6acd22d2d0c40b84d99967afb42a, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Transform: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_InstancedGameObject: {fileID: 0} + m_Flags: 1 + m_ColliderType: 2 diff --git a/Assets/Sprites/Tileset_2.asset.meta b/Assets/Sprites/Tileset_2.asset.meta new file mode 100644 index 0000000..e1e7f35 --- /dev/null +++ b/Assets/Sprites/Tileset_2.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c172c8f07ca54fc4bb68b1c1845a5789 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 12ce8ec..4ac503d 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -10,13 +10,13 @@ TagManager: - Default - TransparentFX - Ignore Raycast - - Walls + - Map - Water - UI - - Ladders - - Players - - + - Players + - - - -