mirror of
				https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
				synced 2025-06-27 11:58:51 +02:00 
			
		
		
		
	fix: rotation, smooth camera, ship portal collider, obstacle block collider, player rigid body detection, dynamic ground (#54)
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 14 KiB | 
							
								
								
									
										
											BIN
										
									
								
								Assets/Resources/InGame/PauseIcon.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Assets/Resources/InGame/PauseIcon.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 10 KiB | 
| @@ -1,10 +1,10 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: c51e366cbbc7cd534a9788dd491e8086 | ||||
| guid: 7bbd15eb9b940f4c59561753a3d516ce | ||||
| TextureImporter: | ||||
|   internalIDToNameTable: | ||||
|   - first: | ||||
|       213: 6208176927266180224 | ||||
|     second: Play_0 | ||||
|       213: -2073137460773038770 | ||||
|     second: PauseIcon_0 | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 13 | ||||
|   mipmaps: | ||||
| @@ -113,13 +113,13 @@ TextureImporter: | ||||
|     serializedVersion: 2 | ||||
|     sprites: | ||||
|     - serializedVersion: 2 | ||||
|       name: Play_0 | ||||
|       name: PauseIcon_0 | ||||
|       rect: | ||||
|         serializedVersion: 2 | ||||
|         x: 7 | ||||
|         y: 7 | ||||
|         x: 17 | ||||
|         y: 19 | ||||
|         width: 239 | ||||
|         height: 238 | ||||
|         height: 218 | ||||
|       alignment: 0 | ||||
|       pivot: {x: 0, y: 0} | ||||
|       border: {x: 0, y: 0, z: 0, w: 0} | ||||
| @@ -128,8 +128,8 @@ TextureImporter: | ||||
|       physicsShape: [] | ||||
|       tessellationDetail: -1 | ||||
|       bones: [] | ||||
|       spriteID: 08c0a74e500e72650800000000000000 | ||||
|       internalID: 6208176927266180224 | ||||
|       spriteID: e455110a67cba33e0800000000000000 | ||||
|       internalID: -2073137460773038770 | ||||
|       vertices: [] | ||||
|       indices:  | ||||
|       edges: [] | ||||
| @@ -147,8 +147,7 @@ TextureImporter: | ||||
|     secondaryTextures: [] | ||||
|     spriteCustomMetadata: | ||||
|       entries: [] | ||||
|     nameFileIdTable: | ||||
|       Play_0: 6208176927266180224 | ||||
|     nameFileIdTable: {} | ||||
|   mipmapLimitGroupName:  | ||||
|   pSDRemoveMatte: 0 | ||||
|   userData:  | ||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 56 KiB | 
							
								
								
									
										
											BIN
										
									
								
								Assets/Resources/InGame/PlayIcon.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Assets/Resources/InGame/PlayIcon.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 48 KiB | 
| @@ -1,10 +1,10 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 4874b4932ea8df273aafe2c64ec3e05a | ||||
| guid: 23d8ef624fc9e5f3fa3f695b9385f5cc | ||||
| TextureImporter: | ||||
|   internalIDToNameTable: | ||||
|   - first: | ||||
|       213: -8878088185706026076 | ||||
|     second: pause_0 | ||||
|       213: -8770034739519435172 | ||||
|     second: PlayIcon_0 | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 13 | ||||
|   mipmaps: | ||||
| @@ -113,13 +113,13 @@ TextureImporter: | ||||
|     serializedVersion: 2 | ||||
|     sprites: | ||||
|     - serializedVersion: 2 | ||||
|       name: pause_0 | ||||
|       name: PlayIcon_0 | ||||
|       rect: | ||||
|         serializedVersion: 2 | ||||
|         x: 0 | ||||
|         y: 0 | ||||
|         width: 256 | ||||
|         height: 256 | ||||
|         x: 26 | ||||
|         y: 27 | ||||
|         width: 206 | ||||
|         height: 199 | ||||
|       alignment: 0 | ||||
|       pivot: {x: 0, y: 0} | ||||
|       border: {x: 0, y: 0, z: 0, w: 0} | ||||
| @@ -128,8 +128,8 @@ TextureImporter: | ||||
|       physicsShape: [] | ||||
|       tessellationDetail: -1 | ||||
|       bones: [] | ||||
|       spriteID: 4ab666e45d1bac480800000000000000 | ||||
|       internalID: -8878088185706026076 | ||||
|       spriteID: c5ecb1bbed39a4680800000000000000 | ||||
|       internalID: -8770034739519435172 | ||||
|       vertices: [] | ||||
|       indices:  | ||||
|       edges: [] | ||||
| @@ -147,8 +147,7 @@ TextureImporter: | ||||
|     secondaryTextures: [] | ||||
|     spriteCustomMetadata: | ||||
|       entries: [] | ||||
|     nameFileIdTable: | ||||
|       pause_0: -8878088185706026076 | ||||
|     nameFileIdTable: {} | ||||
|   mipmapLimitGroupName:  | ||||
|   pSDRemoveMatte: 0 | ||||
|   userData:  | ||||
							
								
								
									
										136
									
								
								Assets/Resources/Prefabs/Ground.prefab
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								Assets/Resources/Prefabs/Ground.prefab
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,136 @@ | ||||
| %YAML 1.1 | ||||
| %TAG !u! tag:unity3d.com,2011: | ||||
| --- !u!1 &4469289624494365187 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   serializedVersion: 6 | ||||
|   m_Component: | ||||
|   - component: {fileID: 8964879669643113576} | ||||
|   - component: {fileID: 5612594502755166219} | ||||
|   - component: {fileID: 1469510466419132587} | ||||
|   m_Layer: 0 | ||||
|   m_Name: Ground | ||||
|   m_TagString: Untagged | ||||
|   m_Icon: {fileID: 0} | ||||
|   m_NavMeshLayer: 0 | ||||
|   m_StaticEditorFlags: 0 | ||||
|   m_IsActive: 1 | ||||
| --- !u!4 &8964879669643113576 | ||||
| Transform: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 4469289624494365187} | ||||
|   serializedVersion: 2 | ||||
|   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||||
|   m_LocalPosition: {x: -15.92, y: -5.7, z: 0} | ||||
|   m_LocalScale: {x: 1, y: 0.8581, z: 1} | ||||
|   m_ConstrainProportionsScale: 0 | ||||
|   m_Children: [] | ||||
|   m_Father: {fileID: 0} | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
| --- !u!212 &5612594502755166219 | ||||
| SpriteRenderer: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 4469289624494365187} | ||||
|   m_Enabled: 1 | ||||
|   m_CastShadows: 0 | ||||
|   m_ReceiveShadows: 0 | ||||
|   m_DynamicOccludee: 1 | ||||
|   m_StaticShadowCaster: 0 | ||||
|   m_MotionVectors: 1 | ||||
|   m_LightProbeUsage: 1 | ||||
|   m_ReflectionProbeUsage: 1 | ||||
|   m_RayTracingMode: 0 | ||||
|   m_RayTraceProcedural: 0 | ||||
|   m_RayTracingAccelStructBuildFlagsOverride: 0 | ||||
|   m_RayTracingAccelStructBuildFlags: 1 | ||||
|   m_SmallMeshCulling: 1 | ||||
|   m_RenderingLayerMask: 1 | ||||
|   m_RendererPriority: 0 | ||||
|   m_Materials: | ||||
|   - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} | ||||
|   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: 0 | ||||
|   m_SortingLayer: 0 | ||||
|   m_SortingOrder: 0 | ||||
|   m_Sprite: {fileID: -2257217325195158302, guid: a192a62ef32304b4182909c80a175f39, type: 3} | ||||
|   m_Color: {r: 1, g: 1, b: 1, a: 1} | ||||
|   m_FlipX: 0 | ||||
|   m_FlipY: 0 | ||||
|   m_DrawMode: 0 | ||||
|   m_Size: {x: 5.12, y: 5.12} | ||||
|   m_AdaptiveModeThreshold: 0.5 | ||||
|   m_SpriteTileMode: 0 | ||||
|   m_WasSpriteAssigned: 1 | ||||
|   m_MaskInteraction: 0 | ||||
|   m_SpriteSortPoint: 0 | ||||
| --- !u!61 &1469510466419132587 | ||||
| BoxCollider2D: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 4469289624494365187} | ||||
|   m_Enabled: 1 | ||||
|   serializedVersion: 3 | ||||
|   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: 0 | ||||
|   m_UsedByEffector: 0 | ||||
|   m_CompositeOperation: 0 | ||||
|   m_CompositeOrder: 0 | ||||
|   m_Offset: {x: 0, y: 0} | ||||
|   m_SpriteTilingProperty: | ||||
|     border: {x: 0, y: 0, z: 0, w: 0} | ||||
|     pivot: {x: 0.5, y: 0.5} | ||||
|     oldSize: {x: 5.12, y: 5.12} | ||||
|     newSize: {x: 5.12, y: 5.12} | ||||
|     adaptiveTilingThreshold: 0.5 | ||||
|     drawMode: 0 | ||||
|     adaptiveTiling: 0 | ||||
|   m_AutoTiling: 0 | ||||
|   m_Size: {x: 5.12, y: 5.12} | ||||
|   m_EdgeRadius: 0 | ||||
							
								
								
									
										7
									
								
								Assets/Resources/Prefabs/Ground.prefab.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Assets/Resources/Prefabs/Ground.prefab.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 052f6240a620828cea410bf389122be0 | ||||
| PrefabImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -202,7 +202,7 @@ BoxCollider2D: | ||||
|   m_UsedByEffector: 0 | ||||
|   m_CompositeOperation: 0 | ||||
|   m_CompositeOrder: 0 | ||||
|   m_Offset: {x: -0.0040085316, y: -0.985047} | ||||
|   m_Offset: {x: -0.0040085316, y: -0.35639262} | ||||
|   m_SpriteTilingProperty: | ||||
|     border: {x: 0, y: 0, z: 0, w: 0} | ||||
|     pivot: {x: 0, y: 0} | ||||
| @@ -212,7 +212,7 @@ BoxCollider2D: | ||||
|     drawMode: 0 | ||||
|     adaptiveTiling: 0 | ||||
|   m_AutoTiling: 0 | ||||
|   m_Size: {x: 5.1211915, y: 2.672097} | ||||
|   m_Size: {x: 5.1211915, y: 4.4239116} | ||||
|   m_EdgeRadius: 0 | ||||
| --- !u!1 &4179475610744468388 | ||||
| GameObject: | ||||
| @@ -280,7 +280,7 @@ BoxCollider2D: | ||||
|   m_UsedByEffector: 0 | ||||
|   m_CompositeOperation: 0 | ||||
|   m_CompositeOrder: 0 | ||||
|   m_Offset: {x: -0.004009247, y: 1.7748187} | ||||
|   m_Offset: {x: 0.0038814545, y: 2.4709496} | ||||
|   m_SpriteTilingProperty: | ||||
|     border: {x: 0, y: 0, z: 0, w: 0} | ||||
|     pivot: {x: 0, y: 0} | ||||
| @@ -290,5 +290,5 @@ BoxCollider2D: | ||||
|     drawMode: 0 | ||||
|     adaptiveTiling: 0 | ||||
|   m_AutoTiling: 0 | ||||
|   m_Size: {x: 5.121194, y: 1.4569769} | ||||
|   m_Size: {x: 5.1474953, y: 0.20310307} | ||||
|   m_EdgeRadius: 0 | ||||
|   | ||||
| @@ -122,7 +122,7 @@ BoxCollider2D: | ||||
|   m_UsedByEffector: 0 | ||||
|   m_CompositeOperation: 0 | ||||
|   m_CompositeOrder: 0 | ||||
|   m_Offset: {x: 0, y: 0} | ||||
|   m_Offset: {x: 0.0058231354, y: 0.09898627} | ||||
|   m_SpriteTilingProperty: | ||||
|     border: {x: 0, y: 0, z: 0, w: 0} | ||||
|     pivot: {x: 0.5, y: 0.5} | ||||
| @@ -132,5 +132,5 @@ BoxCollider2D: | ||||
|     drawMode: 0 | ||||
|     adaptiveTiling: 0 | ||||
|   m_AutoTiling: 0 | ||||
|   m_Size: {x: 0.6, y: 1.06} | ||||
|   m_Size: {x: 0.97265434, y: 3.202761} | ||||
|   m_EdgeRadius: 0 | ||||
|   | ||||
| @@ -543,6 +543,7 @@ MonoBehaviour: | ||||
|   playerObject: {fileID: 1267397455} | ||||
|   normalMinYFollow: 2 | ||||
|   shipMinYFollow: 6 | ||||
|   smoothSpeed: 5 | ||||
| --- !u!1 &521952199 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
| @@ -6220,7 +6221,7 @@ MonoBehaviour: | ||||
|   m_OnCullStateChanged: | ||||
|     m_PersistentCalls: | ||||
|       m_Calls: [] | ||||
|   m_Sprite: {fileID: -8878088185706026076, guid: 4874b4932ea8df273aafe2c64ec3e05a, type: 3} | ||||
|   m_Sprite: {fileID: -2073137460773038770, guid: 7bbd15eb9b940f4c59561753a3d516ce, type: 3} | ||||
|   m_Type: 0 | ||||
|   m_PreserveAspect: 0 | ||||
|   m_FillCenter: 1 | ||||
| @@ -6273,140 +6274,6 @@ RectTransform: | ||||
|   m_AnchoredPosition: {x: 0, y: 0} | ||||
|   m_SizeDelta: {x: 100, y: 100} | ||||
|   m_Pivot: {x: 0.5, y: 0.5} | ||||
| --- !u!1 &1235900592 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   serializedVersion: 6 | ||||
|   m_Component: | ||||
|   - component: {fileID: 1235900594} | ||||
|   - component: {fileID: 1235900593} | ||||
|   - component: {fileID: 1235900595} | ||||
|   m_Layer: 0 | ||||
|   m_Name: Ground | ||||
|   m_TagString: Untagged | ||||
|   m_Icon: {fileID: 0} | ||||
|   m_NavMeshLayer: 0 | ||||
|   m_StaticEditorFlags: 0 | ||||
|   m_IsActive: 1 | ||||
| --- !u!212 &1235900593 | ||||
| SpriteRenderer: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 1235900592} | ||||
|   m_Enabled: 1 | ||||
|   m_CastShadows: 0 | ||||
|   m_ReceiveShadows: 0 | ||||
|   m_DynamicOccludee: 1 | ||||
|   m_StaticShadowCaster: 0 | ||||
|   m_MotionVectors: 1 | ||||
|   m_LightProbeUsage: 1 | ||||
|   m_ReflectionProbeUsage: 1 | ||||
|   m_RayTracingMode: 0 | ||||
|   m_RayTraceProcedural: 0 | ||||
|   m_RayTracingAccelStructBuildFlagsOverride: 0 | ||||
|   m_RayTracingAccelStructBuildFlags: 1 | ||||
|   m_SmallMeshCulling: 1 | ||||
|   m_RenderingLayerMask: 1 | ||||
|   m_RendererPriority: 0 | ||||
|   m_Materials: | ||||
|   - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} | ||||
|   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: 0 | ||||
|   m_SortingLayer: 0 | ||||
|   m_SortingOrder: 0 | ||||
|   m_Sprite: {fileID: -2257217325195158302, guid: a192a62ef32304b4182909c80a175f39, type: 3} | ||||
|   m_Color: {r: 1, g: 1, b: 1, a: 1} | ||||
|   m_FlipX: 0 | ||||
|   m_FlipY: 0 | ||||
|   m_DrawMode: 0 | ||||
|   m_Size: {x: 5.12, y: 5.12} | ||||
|   m_AdaptiveModeThreshold: 0.5 | ||||
|   m_SpriteTileMode: 0 | ||||
|   m_WasSpriteAssigned: 1 | ||||
|   m_MaskInteraction: 0 | ||||
|   m_SpriteSortPoint: 0 | ||||
| --- !u!4 &1235900594 | ||||
| Transform: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 1235900592} | ||||
|   serializedVersion: 2 | ||||
|   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||||
|   m_LocalPosition: {x: 353.61, y: -5.69, z: 0} | ||||
|   m_LocalScale: {x: 150, y: 0.8581, z: 1} | ||||
|   m_ConstrainProportionsScale: 0 | ||||
|   m_Children: [] | ||||
|   m_Father: {fileID: 0} | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
| --- !u!61 &1235900595 | ||||
| BoxCollider2D: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 1235900592} | ||||
|   m_Enabled: 1 | ||||
|   serializedVersion: 3 | ||||
|   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: 0 | ||||
|   m_UsedByEffector: 0 | ||||
|   m_CompositeOperation: 0 | ||||
|   m_CompositeOrder: 0 | ||||
|   m_Offset: {x: 0, y: 0} | ||||
|   m_SpriteTilingProperty: | ||||
|     border: {x: 0, y: 0, z: 0, w: 0} | ||||
|     pivot: {x: 0.5, y: 0.5} | ||||
|     oldSize: {x: 5.12, y: 5.12} | ||||
|     newSize: {x: 5.12, y: 5.12} | ||||
|     adaptiveTilingThreshold: 0.5 | ||||
|     drawMode: 0 | ||||
|     adaptiveTiling: 0 | ||||
|   m_AutoTiling: 0 | ||||
|   m_Size: {x: 5.12, y: 5.12} | ||||
|   m_EdgeRadius: 0 | ||||
| --- !u!1 &1267397455 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
| @@ -6451,9 +6318,9 @@ Rigidbody2D: | ||||
|     serializedVersion: 2 | ||||
|     m_Bits: 0 | ||||
|   m_Interpolate: 0 | ||||
|   m_SleepingMode: 1 | ||||
|   m_CollisionDetection: 0 | ||||
|   m_Constraints: 0 | ||||
|   m_SleepingMode: 0 | ||||
|   m_CollisionDetection: 1 | ||||
|   m_Constraints: 4 | ||||
| --- !u!212 &1267397457 | ||||
| SpriteRenderer: | ||||
|   m_ObjectHideFlags: 0 | ||||
| @@ -7158,7 +7025,7 @@ MonoBehaviour: | ||||
|   m_OnCullStateChanged: | ||||
|     m_PersistentCalls: | ||||
|       m_Calls: [] | ||||
|   m_Sprite: {fileID: 6208176927266180224, guid: c51e366cbbc7cd534a9788dd491e8086, type: 3} | ||||
|   m_Sprite: {fileID: -8770034739519435172, guid: 23d8ef624fc9e5f3fa3f695b9385f5cc, type: 3} | ||||
|   m_Type: 0 | ||||
|   m_PreserveAspect: 0 | ||||
|   m_FillCenter: 1 | ||||
| @@ -7450,6 +7317,7 @@ MonoBehaviour: | ||||
|   levelsLoader: {fileID: 0} | ||||
|   audioSource: {fileID: 1999482188} | ||||
|   progressionText: {fileID: 245275149} | ||||
|   groundWidth: 1 | ||||
| --- !u!4 &1999482187 | ||||
| Transform: | ||||
|   m_ObjectHideFlags: 0 | ||||
| @@ -7603,7 +7471,6 @@ SceneRoots: | ||||
|   m_Roots: | ||||
|   - {fileID: 519420032} | ||||
|   - {fileID: 1267397458} | ||||
|   - {fileID: 1235900594} | ||||
|   - {fileID: 1999482187} | ||||
|   - {fileID: 1371294550} | ||||
|   - {fileID: 521952202} | ||||
|   | ||||
| @@ -1,30 +1,38 @@ | ||||
| using UnityEngine; | ||||
| using UnityEngine.SceneManagement; | ||||
|  | ||||
|  | ||||
| public class NormalGameMode : IGameMode | ||||
| { | ||||
|     private const float HorizontalSpeed = 8.6f; | ||||
|     private const float JumpForce = 26.6581f; | ||||
|     private const KeyCode JumpKey = KeyCode.Space; | ||||
|     private bool isRotating = false; | ||||
|     private float targetRotationAngle = 0f; | ||||
|     private readonly float rotationSpeed = 360f; | ||||
|  | ||||
|     public void Update(Player player) | ||||
|     { | ||||
|         player.RigidBody.linearVelocity = new Vector2(HorizontalSpeed * player.SpeedMultiplier, player.RigidBody.linearVelocity.y); | ||||
|  | ||||
|         if (player.HasStarted && player.IsColliding && Input.GetKey(JumpKey) && player.CanJump) | ||||
|  | ||||
|         if (player.IsColliding && Input.GetKey(JumpKey) && !isRotating) | ||||
|         { | ||||
|             Jump(player); | ||||
|         } | ||||
|  | ||||
|         if (isRotating) | ||||
|         { | ||||
|             PerformRotation(player); | ||||
|         } | ||||
|  | ||||
|         if (!IsJumping(player)) | ||||
|         { | ||||
|             AlignRotation(player); | ||||
|             player.Particle.gameObject.SetActive(true); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             player.Particle.gameObject.SetActive(false); | ||||
|             player.Transform.Rotate(Vector3.back * 360 * Time.deltaTime); | ||||
|         } | ||||
|  | ||||
|         UpdateParticlePositionAndRotation(player); | ||||
| @@ -35,6 +43,22 @@ public class NormalGameMode : IGameMode | ||||
|         player.RigidBody.linearVelocity = new Vector2(player.RigidBody.linearVelocity.x, 0); | ||||
|         player.RigidBody.AddForce(Vector2.up * JumpForce, ForceMode2D.Impulse); | ||||
|         player.LevelsLoader.IncreaseTotalJumps(); | ||||
|         isRotating = true; | ||||
|         targetRotationAngle = player.transform.eulerAngles.z - 90f; | ||||
|     } | ||||
|  | ||||
|     private void PerformRotation(Player player) | ||||
|     { | ||||
|         float rotationThisFrame = rotationSpeed * Time.deltaTime; | ||||
|         float newRotation = Mathf.MoveTowardsAngle(player.transform.eulerAngles.z, targetRotationAngle, rotationThisFrame); | ||||
|         player.transform.rotation = Quaternion.Euler(0, 0, newRotation); | ||||
|  | ||||
|         if (Mathf.Abs(Mathf.DeltaAngle(newRotation, targetRotationAngle)) < 0.1f) | ||||
|         { | ||||
|             player.transform.rotation = Quaternion.Euler(0, 0, targetRotationAngle); | ||||
|             isRotating = false; | ||||
|             AlignRotation(player); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private bool IsJumping(Player player) | ||||
| @@ -44,21 +68,21 @@ public class NormalGameMode : IGameMode | ||||
|  | ||||
|     private void AlignRotation(Player player) | ||||
|     { | ||||
|         Vector3 rotation = player.Transform.rotation.eulerAngles; | ||||
|         Vector3 rotation = player.transform.eulerAngles; | ||||
|         rotation.z = Mathf.Round(rotation.z / 90) * 90; | ||||
|         player.Transform.rotation = Quaternion.Euler(rotation); | ||||
|         player.transform.rotation = Quaternion.Euler(rotation); | ||||
|     } | ||||
|  | ||||
|     private void UpdateParticlePositionAndRotation(Player player) | ||||
|     { | ||||
|         player.Particle.transform.position = player.Transform.position + new Vector3(-0.19f, -0.64f, -10); | ||||
|         player.Particle.transform.position = | ||||
|         player.transform.position + new Vector3(-0.19f, -0.64f, -10); | ||||
|         player.Particle.transform.rotation = Quaternion.Euler(0, 0, 150.464f); | ||||
|     } | ||||
|  | ||||
|     public void OnCollisionEnter(Player player, Collision2D collision) | ||||
|     { | ||||
|         player.IsColliding = true; | ||||
|         player.CanJump = true; | ||||
|  | ||||
|         if (collision.gameObject.CompareTag("Kill")) | ||||
|         { | ||||
|   | ||||
| @@ -16,7 +16,7 @@ public class ShipGameMode : IGameMode | ||||
|  | ||||
|         bool jumpPressed = Input.GetKey(JumpKey); | ||||
|  | ||||
|         if (player.HasStarted && jumpPressed) | ||||
|         if (jumpPressed) | ||||
|         { | ||||
|             Jump(player); | ||||
|  | ||||
| @@ -49,7 +49,9 @@ public class ShipGameMode : IGameMode | ||||
|     { | ||||
|         float angle = player.Transform.rotation.eulerAngles.z; | ||||
|         if (angle > 180f) | ||||
|         { | ||||
|             angle -= 360f; | ||||
|         } | ||||
|         return angle; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -7,6 +7,7 @@ public class LevelLoader : MonoBehaviour | ||||
|     public LevelsLoader levelsLoader; | ||||
|     public AudioSource audioSource; | ||||
|     public Text progressionText; | ||||
|     private readonly float groundY = -6.034f; | ||||
|  | ||||
|     private GameObject GetPrefab(string type) | ||||
|     { | ||||
| @@ -43,6 +44,12 @@ public class LevelLoader : MonoBehaviour | ||||
|  | ||||
|             instance.transform.localScale = new Vector3(newScaleX, newScaleY, originalScale.z); | ||||
|         } | ||||
|  | ||||
|         GameObject groundPrefab = GetPrefab("Ground"); | ||||
|         GameObject groundInstance = Instantiate(groundPrefab, new Vector3(current.LastX / 2, groundY, 0), Quaternion.identity); | ||||
|         float groundWidth = current.LastX; | ||||
|         groundInstance.transform.localScale = new Vector3(groundWidth / 5f * 2, 1, 1); | ||||
|  | ||||
|         Instantiate(GetPrefab("WinnerWall"), new Vector3(current.LastX, 0, 0), Quaternion.Euler(0, 0, 90)); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -9,8 +9,6 @@ public class Player : MonoBehaviour | ||||
|     public LevelsLoader LevelsLoader { get; private set; } | ||||
|     public SpriteRenderer SpriteRenderer { get; private set; } | ||||
|     public bool IsColliding { get; set; } = true; | ||||
|     public bool HasStarted { get; private set; } = false; | ||||
|     public bool CanJump { get; set; } = true; | ||||
|  | ||||
|     public IGameMode CurrentGameMode { get; set; } | ||||
|     public float SpeedMultiplier = 1f; | ||||
| @@ -30,16 +28,9 @@ public class Player : MonoBehaviour | ||||
|         mainModule.simulationSpace = ParticleSystemSimulationSpace.World; | ||||
|         Particle.transform.parent = null; | ||||
|  | ||||
|         Invoke(nameof(EnableInput), 0.1f); | ||||
|  | ||||
|         CurrentGameMode = new NormalGameMode(); | ||||
|     } | ||||
|  | ||||
|     private void EnableInput() | ||||
|     { | ||||
|         HasStarted = true; | ||||
|     } | ||||
|  | ||||
|     public void Update() | ||||
|     { | ||||
|         CurrentGameMode.Update(this); | ||||
|   | ||||
| @@ -5,6 +5,7 @@ public class PlayerCamera : MonoBehaviour | ||||
|     public GameObject playerObject; | ||||
|     public float normalMinYFollow = 2.0f; | ||||
|     public float shipMinYFollow = 6.0f; | ||||
|     public float smoothSpeed = 5.0f; | ||||
|     private float initialY; | ||||
|  | ||||
|     private void Start() | ||||
| @@ -28,6 +29,8 @@ public class PlayerCamera : MonoBehaviour | ||||
|             targetY = playerObject.transform.position.y; | ||||
|         } | ||||
|  | ||||
|         transform.position = new Vector3(playerObject.transform.position.x, targetY, transform.position.z); | ||||
|         float newY = Mathf.Lerp(transform.position.y, targetY, smoothSpeed * Time.deltaTime); | ||||
|  | ||||
|         transform.position = new Vector3(playerObject.transform.position.x, newY, transform.position.z); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user