mirror of
				https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
				synced 2025-06-27 11:58:51 +02:00 
			
		
		
		
	feat: init AI (#60)
This commit is contained in:
		
							
								
								
									
										19
									
								
								Assets/AI.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								Assets/AI.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | |||||||
|  | using UnityEngine; | ||||||
|  | using UnityEngine.UI; | ||||||
|  |  | ||||||
|  | public class AI : MonoBehaviour | ||||||
|  | { | ||||||
|  |     public Toggle AIToggle; | ||||||
|  |     public Player player; | ||||||
|  |  | ||||||
|  |     public void OnAiChange() | ||||||
|  |     { | ||||||
|  |         player.IsAI = AIToggle.isOn; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void Awake() | ||||||
|  |     { | ||||||
|  |         AIToggle = GetComponent<Toggle>(); | ||||||
|  |         AIToggle.isOn = player.IsAI; | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										2
									
								
								Assets/AI.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								Assets/AI.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | |||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: b63079a9773c036389c5b87c12e728c3 | ||||||
							
								
								
									
										80
									
								
								Assets/Resources/AICollider.prefab
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								Assets/Resources/AICollider.prefab
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,80 @@ | |||||||
|  | %YAML 1.1 | ||||||
|  | %TAG !u! tag:unity3d.com,2011: | ||||||
|  | --- !u!1 &3654053280041398781 | ||||||
|  | GameObject: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   serializedVersion: 6 | ||||||
|  |   m_Component: | ||||||
|  |   - component: {fileID: 4104371471751400115} | ||||||
|  |   - component: {fileID: 1415423667558431683} | ||||||
|  |   m_Layer: 0 | ||||||
|  |   m_Name: AICollider | ||||||
|  |   m_TagString: AICollider | ||||||
|  |   m_Icon: {fileID: 0} | ||||||
|  |   m_NavMeshLayer: 0 | ||||||
|  |   m_StaticEditorFlags: 0 | ||||||
|  |   m_IsActive: 1 | ||||||
|  | --- !u!4 &4104371471751400115 | ||||||
|  | Transform: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 3654053280041398781} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||||||
|  |   m_LocalPosition: {x: 86.53131, y: 53.261993, z: -5.1268225} | ||||||
|  |   m_LocalScale: {x: 1, y: 1, z: 1} | ||||||
|  |   m_ConstrainProportionsScale: 0 | ||||||
|  |   m_Children: [] | ||||||
|  |   m_Father: {fileID: 0} | ||||||
|  |   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||||
|  | --- !u!61 &1415423667558431683 | ||||||
|  | BoxCollider2D: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 3654053280041398781} | ||||||
|  |   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: 1 | ||||||
|  |   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, y: 0} | ||||||
|  |     oldSize: {x: 0, y: 0} | ||||||
|  |     newSize: {x: 0, y: 0} | ||||||
|  |     adaptiveTilingThreshold: 0 | ||||||
|  |     drawMode: 0 | ||||||
|  |     adaptiveTiling: 0 | ||||||
|  |   m_AutoTiling: 0 | ||||||
|  |   m_Size: {x: 1, y: 1} | ||||||
|  |   m_EdgeRadius: 0 | ||||||
							
								
								
									
										7
									
								
								Assets/Resources/AICollider.prefab.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Assets/Resources/AICollider.prefab.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: a862ece8e0cd6047ea9e799642c7b31c | ||||||
|  | PrefabImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
| @@ -222,6 +222,81 @@ MonoBehaviour: | |||||||
|           m_StringArgument:  |           m_StringArgument:  | ||||||
|           m_BoolArgument: 0 |           m_BoolArgument: 0 | ||||||
|         m_CallState: 2 |         m_CallState: 2 | ||||||
|  | --- !u!1 &99686832 | ||||||
|  | GameObject: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   serializedVersion: 6 | ||||||
|  |   m_Component: | ||||||
|  |   - component: {fileID: 99686833} | ||||||
|  |   - component: {fileID: 99686835} | ||||||
|  |   - component: {fileID: 99686834} | ||||||
|  |   m_Layer: 5 | ||||||
|  |   m_Name: Checkmark | ||||||
|  |   m_TagString: Untagged | ||||||
|  |   m_Icon: {fileID: 0} | ||||||
|  |   m_NavMeshLayer: 0 | ||||||
|  |   m_StaticEditorFlags: 0 | ||||||
|  |   m_IsActive: 1 | ||||||
|  | --- !u!224 &99686833 | ||||||
|  | RectTransform: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 99686832} | ||||||
|  |   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: 295909703} | ||||||
|  |   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||||
|  |   m_AnchorMin: {x: 0.5, y: 0.5} | ||||||
|  |   m_AnchorMax: {x: 0.5, y: 0.5} | ||||||
|  |   m_AnchoredPosition: {x: 0, y: 0} | ||||||
|  |   m_SizeDelta: {x: 36.9547, y: 33.6365} | ||||||
|  |   m_Pivot: {x: 0.5, y: 0.5} | ||||||
|  | --- !u!114 &99686834 | ||||||
|  | MonoBehaviour: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 99686832} | ||||||
|  |   m_Enabled: 1 | ||||||
|  |   m_EditorHideFlags: 0 | ||||||
|  |   m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} | ||||||
|  |   m_Name:  | ||||||
|  |   m_EditorClassIdentifier:  | ||||||
|  |   m_Material: {fileID: 0} | ||||||
|  |   m_Color: {r: 1, g: 1, b: 1, a: 1} | ||||||
|  |   m_RaycastTarget: 1 | ||||||
|  |   m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} | ||||||
|  |   m_Maskable: 1 | ||||||
|  |   m_OnCullStateChanged: | ||||||
|  |     m_PersistentCalls: | ||||||
|  |       m_Calls: [] | ||||||
|  |   m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} | ||||||
|  |   m_Type: 0 | ||||||
|  |   m_PreserveAspect: 0 | ||||||
|  |   m_FillCenter: 1 | ||||||
|  |   m_FillMethod: 4 | ||||||
|  |   m_FillAmount: 1 | ||||||
|  |   m_FillClockwise: 1 | ||||||
|  |   m_FillOrigin: 0 | ||||||
|  |   m_UseSpriteMesh: 0 | ||||||
|  |   m_PixelsPerUnitMultiplier: 1 | ||||||
|  | --- !u!222 &99686835 | ||||||
|  | CanvasRenderer: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 99686832} | ||||||
|  |   m_CullTransparentMesh: 1 | ||||||
| --- !u!1 &245275147 | --- !u!1 &245275147 | ||||||
| GameObject: | GameObject: | ||||||
|   m_ObjectHideFlags: 0 |   m_ObjectHideFlags: 0 | ||||||
| @@ -301,6 +376,82 @@ CanvasRenderer: | |||||||
|   m_PrefabAsset: {fileID: 0} |   m_PrefabAsset: {fileID: 0} | ||||||
|   m_GameObject: {fileID: 245275147} |   m_GameObject: {fileID: 245275147} | ||||||
|   m_CullTransparentMesh: 1 |   m_CullTransparentMesh: 1 | ||||||
|  | --- !u!1 &295909702 | ||||||
|  | GameObject: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   serializedVersion: 6 | ||||||
|  |   m_Component: | ||||||
|  |   - component: {fileID: 295909703} | ||||||
|  |   - component: {fileID: 295909705} | ||||||
|  |   - component: {fileID: 295909704} | ||||||
|  |   m_Layer: 5 | ||||||
|  |   m_Name: Background | ||||||
|  |   m_TagString: Untagged | ||||||
|  |   m_Icon: {fileID: 0} | ||||||
|  |   m_NavMeshLayer: 0 | ||||||
|  |   m_StaticEditorFlags: 0 | ||||||
|  |   m_IsActive: 1 | ||||||
|  | --- !u!224 &295909703 | ||||||
|  | RectTransform: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 295909702} | ||||||
|  |   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: | ||||||
|  |   - {fileID: 99686833} | ||||||
|  |   m_Father: {fileID: 2145558729} | ||||||
|  |   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||||
|  |   m_AnchorMin: {x: 0.5, y: 0.5} | ||||||
|  |   m_AnchorMax: {x: 0.5, y: 0.5} | ||||||
|  |   m_AnchoredPosition: {x: 0, y: 0} | ||||||
|  |   m_SizeDelta: {x: 49.9975, y: 40.9} | ||||||
|  |   m_Pivot: {x: 0.5, y: 0.5} | ||||||
|  | --- !u!114 &295909704 | ||||||
|  | MonoBehaviour: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 295909702} | ||||||
|  |   m_Enabled: 1 | ||||||
|  |   m_EditorHideFlags: 0 | ||||||
|  |   m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} | ||||||
|  |   m_Name:  | ||||||
|  |   m_EditorClassIdentifier:  | ||||||
|  |   m_Material: {fileID: 0} | ||||||
|  |   m_Color: {r: 1, g: 1, b: 1, a: 1} | ||||||
|  |   m_RaycastTarget: 1 | ||||||
|  |   m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} | ||||||
|  |   m_Maskable: 1 | ||||||
|  |   m_OnCullStateChanged: | ||||||
|  |     m_PersistentCalls: | ||||||
|  |       m_Calls: [] | ||||||
|  |   m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} | ||||||
|  |   m_Type: 1 | ||||||
|  |   m_PreserveAspect: 0 | ||||||
|  |   m_FillCenter: 1 | ||||||
|  |   m_FillMethod: 4 | ||||||
|  |   m_FillAmount: 1 | ||||||
|  |   m_FillClockwise: 1 | ||||||
|  |   m_FillOrigin: 0 | ||||||
|  |   m_UseSpriteMesh: 0 | ||||||
|  |   m_PixelsPerUnitMultiplier: 1 | ||||||
|  | --- !u!222 &295909705 | ||||||
|  | CanvasRenderer: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 295909702} | ||||||
|  |   m_CullTransparentMesh: 1 | ||||||
| --- !u!1 &487176671 | --- !u!1 &487176671 | ||||||
| GameObject: | GameObject: | ||||||
|   m_ObjectHideFlags: 0 |   m_ObjectHideFlags: 0 | ||||||
| @@ -389,6 +540,10 @@ PrefabInstance: | |||||||
|       propertyPath: m_Name |       propertyPath: m_Name | ||||||
|       value: BonusBoostSpeed |       value: BonusBoostSpeed | ||||||
|       objectReference: {fileID: 0} |       objectReference: {fileID: 0} | ||||||
|  |     - target: {fileID: 3025146551836412649, guid: 5d01d2d55c6c25541b0db90186e76c2b, type: 3} | ||||||
|  |       propertyPath: m_IsActive | ||||||
|  |       value: 0 | ||||||
|  |       objectReference: {fileID: 0} | ||||||
|     - target: {fileID: 7134261581051338486, guid: 5d01d2d55c6c25541b0db90186e76c2b, type: 3} |     - target: {fileID: 7134261581051338486, guid: 5d01d2d55c6c25541b0db90186e76c2b, type: 3} | ||||||
|       propertyPath: m_LocalPosition.x |       propertyPath: m_LocalPosition.x | ||||||
|       value: -2 |       value: -2 | ||||||
| @@ -5828,6 +5983,8 @@ RectTransform: | |||||||
|   - {fileID: 1269654000} |   - {fileID: 1269654000} | ||||||
|   - {fileID: 1464555240} |   - {fileID: 1464555240} | ||||||
|   - {fileID: 6776933} |   - {fileID: 6776933} | ||||||
|  |   - {fileID: 2145558729} | ||||||
|  |   - {fileID: 2049642316} | ||||||
|   m_Father: {fileID: 1371294550} |   m_Father: {fileID: 1371294550} | ||||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||||
|   m_AnchorMin: {x: 0.5, y: 0.5} |   m_AnchorMin: {x: 0.5, y: 0.5} | ||||||
| @@ -6406,6 +6563,7 @@ MonoBehaviour: | |||||||
|   m_Name:  |   m_Name:  | ||||||
|   m_EditorClassIdentifier:  |   m_EditorClassIdentifier:  | ||||||
|   SpeedMultiplier: 1 |   SpeedMultiplier: 1 | ||||||
|  |   IsAI: 0 | ||||||
| --- !u!61 &1267397460 | --- !u!61 &1267397460 | ||||||
| BoxCollider2D: | BoxCollider2D: | ||||||
|   m_ObjectHideFlags: 0 |   m_ObjectHideFlags: 0 | ||||||
| @@ -7465,6 +7623,197 @@ RectTransform: | |||||||
|   m_AnchoredPosition: {x: 0, y: 0} |   m_AnchoredPosition: {x: 0, y: 0} | ||||||
|   m_SizeDelta: {x: 100, y: 100} |   m_SizeDelta: {x: 100, y: 100} | ||||||
|   m_Pivot: {x: 0.5, y: 0.5} |   m_Pivot: {x: 0.5, y: 0.5} | ||||||
|  | --- !u!1 &2049642315 | ||||||
|  | GameObject: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   serializedVersion: 6 | ||||||
|  |   m_Component: | ||||||
|  |   - component: {fileID: 2049642316} | ||||||
|  |   - component: {fileID: 2049642318} | ||||||
|  |   - component: {fileID: 2049642317} | ||||||
|  |   m_Layer: 0 | ||||||
|  |   m_Name: AI | ||||||
|  |   m_TagString: Untagged | ||||||
|  |   m_Icon: {fileID: 0} | ||||||
|  |   m_NavMeshLayer: 0 | ||||||
|  |   m_StaticEditorFlags: 0 | ||||||
|  |   m_IsActive: 1 | ||||||
|  | --- !u!224 &2049642316 | ||||||
|  | RectTransform: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 2049642315} | ||||||
|  |   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} | ||||||
|  |   m_LocalPosition: {x: 0, y: 0, z: -2.9565992} | ||||||
|  |   m_LocalScale: {x: 0.4166666, y: 0.4166666, z: 0.4166666} | ||||||
|  |   m_ConstrainProportionsScale: 0 | ||||||
|  |   m_Children: [] | ||||||
|  |   m_Father: {fileID: 892725782} | ||||||
|  |   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||||
|  |   m_AnchorMin: {x: 0.5, y: 0.5} | ||||||
|  |   m_AnchorMax: {x: 0.5, y: 0.5} | ||||||
|  |   m_AnchoredPosition: {x: -377, y: -274} | ||||||
|  |   m_SizeDelta: {x: 87.0508, y: 79.9371} | ||||||
|  |   m_Pivot: {x: 0.5, y: 0.5} | ||||||
|  | --- !u!114 &2049642317 | ||||||
|  | MonoBehaviour: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 2049642315} | ||||||
|  |   m_Enabled: 1 | ||||||
|  |   m_EditorHideFlags: 0 | ||||||
|  |   m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} | ||||||
|  |   m_Name:  | ||||||
|  |   m_EditorClassIdentifier:  | ||||||
|  |   m_Material: {fileID: 0} | ||||||
|  |   m_Color: {r: 1, g: 1, b: 1, a: 1} | ||||||
|  |   m_RaycastTarget: 1 | ||||||
|  |   m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} | ||||||
|  |   m_Maskable: 1 | ||||||
|  |   m_OnCullStateChanged: | ||||||
|  |     m_PersistentCalls: | ||||||
|  |       m_Calls: [] | ||||||
|  |   m_FontData: | ||||||
|  |     m_Font: {fileID: 12800000, guid: e3265ab4bf004d28a9537516768c1c75, type: 3} | ||||||
|  |     m_FontSize: 56 | ||||||
|  |     m_FontStyle: 0 | ||||||
|  |     m_BestFit: 0 | ||||||
|  |     m_MinSize: 0 | ||||||
|  |     m_MaxSize: 56 | ||||||
|  |     m_Alignment: 0 | ||||||
|  |     m_AlignByGeometry: 0 | ||||||
|  |     m_RichText: 1 | ||||||
|  |     m_HorizontalOverflow: 0 | ||||||
|  |     m_VerticalOverflow: 0 | ||||||
|  |     m_LineSpacing: 1 | ||||||
|  |   m_Text: AI | ||||||
|  | --- !u!222 &2049642318 | ||||||
|  | CanvasRenderer: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 2049642315} | ||||||
|  |   m_CullTransparentMesh: 1 | ||||||
|  | --- !u!1 &2145558728 | ||||||
|  | GameObject: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   serializedVersion: 6 | ||||||
|  |   m_Component: | ||||||
|  |   - component: {fileID: 2145558729} | ||||||
|  |   - component: {fileID: 2145558730} | ||||||
|  |   - component: {fileID: 2145558731} | ||||||
|  |   m_Layer: 5 | ||||||
|  |   m_Name: CheckboxAI | ||||||
|  |   m_TagString: Untagged | ||||||
|  |   m_Icon: {fileID: 0} | ||||||
|  |   m_NavMeshLayer: 0 | ||||||
|  |   m_StaticEditorFlags: 0 | ||||||
|  |   m_IsActive: 1 | ||||||
|  | --- !u!224 &2145558729 | ||||||
|  | RectTransform: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 2145558728} | ||||||
|  |   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: | ||||||
|  |   - {fileID: 295909703} | ||||||
|  |   m_Father: {fileID: 892725782} | ||||||
|  |   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||||
|  |   m_AnchorMin: {x: 0.5, y: 0.5} | ||||||
|  |   m_AnchorMax: {x: 0.5, y: 0.5} | ||||||
|  |   m_AnchoredPosition: {x: -424.55, y: -273.6} | ||||||
|  |   m_SizeDelta: {x: 60.1819, y: 50.9705} | ||||||
|  |   m_Pivot: {x: 0.5, y: 0.5} | ||||||
|  | --- !u!114 &2145558730 | ||||||
|  | MonoBehaviour: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 2145558728} | ||||||
|  |   m_Enabled: 1 | ||||||
|  |   m_EditorHideFlags: 0 | ||||||
|  |   m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3} | ||||||
|  |   m_Name:  | ||||||
|  |   m_EditorClassIdentifier:  | ||||||
|  |   m_Navigation: | ||||||
|  |     m_Mode: 3 | ||||||
|  |     m_WrapAround: 0 | ||||||
|  |     m_SelectOnUp: {fileID: 0} | ||||||
|  |     m_SelectOnDown: {fileID: 0} | ||||||
|  |     m_SelectOnLeft: {fileID: 0} | ||||||
|  |     m_SelectOnRight: {fileID: 0} | ||||||
|  |   m_Transition: 1 | ||||||
|  |   m_Colors: | ||||||
|  |     m_NormalColor: {r: 1, g: 1, b: 1, a: 1} | ||||||
|  |     m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} | ||||||
|  |     m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} | ||||||
|  |     m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} | ||||||
|  |     m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} | ||||||
|  |     m_ColorMultiplier: 1 | ||||||
|  |     m_FadeDuration: 0.1 | ||||||
|  |   m_SpriteState: | ||||||
|  |     m_HighlightedSprite: {fileID: 0} | ||||||
|  |     m_PressedSprite: {fileID: 0} | ||||||
|  |     m_SelectedSprite: {fileID: 0} | ||||||
|  |     m_DisabledSprite: {fileID: 0} | ||||||
|  |   m_AnimationTriggers: | ||||||
|  |     m_NormalTrigger: Normal | ||||||
|  |     m_HighlightedTrigger: Highlighted | ||||||
|  |     m_PressedTrigger: Pressed | ||||||
|  |     m_SelectedTrigger: Selected | ||||||
|  |     m_DisabledTrigger: Disabled | ||||||
|  |   m_Interactable: 1 | ||||||
|  |   m_TargetGraphic: {fileID: 295909704} | ||||||
|  |   toggleTransition: 1 | ||||||
|  |   graphic: {fileID: 99686834} | ||||||
|  |   m_Group: {fileID: 0} | ||||||
|  |   onValueChanged: | ||||||
|  |     m_PersistentCalls: | ||||||
|  |       m_Calls: | ||||||
|  |       - m_Target: {fileID: 2145558731} | ||||||
|  |         m_TargetAssemblyTypeName: AI, Assembly-CSharp | ||||||
|  |         m_MethodName: OnAiChange | ||||||
|  |         m_Mode: 1 | ||||||
|  |         m_Arguments: | ||||||
|  |           m_ObjectArgument: {fileID: 0} | ||||||
|  |           m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine | ||||||
|  |           m_IntArgument: 0 | ||||||
|  |           m_FloatArgument: 0 | ||||||
|  |           m_StringArgument:  | ||||||
|  |           m_BoolArgument: 0 | ||||||
|  |         m_CallState: 2 | ||||||
|  |   m_IsOn: 0 | ||||||
|  | --- !u!114 &2145558731 | ||||||
|  | MonoBehaviour: | ||||||
|  |   m_ObjectHideFlags: 0 | ||||||
|  |   m_CorrespondingSourceObject: {fileID: 0} | ||||||
|  |   m_PrefabInstance: {fileID: 0} | ||||||
|  |   m_PrefabAsset: {fileID: 0} | ||||||
|  |   m_GameObject: {fileID: 2145558728} | ||||||
|  |   m_Enabled: 1 | ||||||
|  |   m_EditorHideFlags: 0 | ||||||
|  |   m_Script: {fileID: 11500000, guid: b63079a9773c036389c5b87c12e728c3, type: 3} | ||||||
|  |   m_Name:  | ||||||
|  |   m_EditorClassIdentifier:  | ||||||
|  |   AIToggle: {fileID: 0} | ||||||
|  |   player: {fileID: 1267397459} | ||||||
| --- !u!1660057539 &9223372036854775807 | --- !u!1660057539 &9223372036854775807 | ||||||
| SceneRoots: | SceneRoots: | ||||||
|   m_ObjectHideFlags: 0 |   m_ObjectHideFlags: 0 | ||||||
|   | |||||||
| @@ -5,4 +5,6 @@ public interface IGameMode | |||||||
|     void Update(Player player); |     void Update(Player player); | ||||||
|     void OnCollisionEnter(Player player, Collision2D collision); |     void OnCollisionEnter(Player player, Collision2D collision); | ||||||
|     void OnCollisionExit(Player player, Collision2D collision); |     void OnCollisionExit(Player player, Collision2D collision); | ||||||
|  |  | ||||||
|  |     void Jump(Player player); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ public class NormalGameMode : IGameMode | |||||||
|         UpdateParticlePositionAndRotation(player); |         UpdateParticlePositionAndRotation(player); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void Jump(Player player) |     public void Jump(Player player) | ||||||
|     { |     { | ||||||
|         player.RigidBody.linearVelocity = new Vector2(player.RigidBody.linearVelocity.x, 0); |         player.RigidBody.linearVelocity = new Vector2(player.RigidBody.linearVelocity.x, 0); | ||||||
|         player.RigidBody.AddForce(Vector2.up * JumpForce, ForceMode2D.Impulse); |         player.RigidBody.AddForce(Vector2.up * JumpForce, ForceMode2D.Impulse); | ||||||
|   | |||||||
| @@ -55,7 +55,7 @@ public class ShipGameMode : IGameMode | |||||||
|         return angle; |         return angle; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void Jump(Player player) |     public void Jump(Player player) | ||||||
|     { |     { | ||||||
|         player.RigidBody.linearVelocity = new Vector2(player.RigidBody.linearVelocity.x, 0); |         player.RigidBody.linearVelocity = new Vector2(player.RigidBody.linearVelocity.x, 0); | ||||||
|         player.RigidBody.AddForce(Vector2.up * JumpForce, ForceMode2D.Impulse); |         player.RigidBody.AddForce(Vector2.up * JumpForce, ForceMode2D.Impulse); | ||||||
|   | |||||||
| @@ -38,6 +38,11 @@ public class LevelLoader : MonoBehaviour | |||||||
|             GameObject prefab = GetPrefab(element.type); |             GameObject prefab = GetPrefab(element.type); | ||||||
|             GameObject instance = Instantiate(prefab, new Vector3(element.x, element.y, 0), Quaternion.identity); |             GameObject instance = Instantiate(prefab, new Vector3(element.x, element.y, 0), Quaternion.identity); | ||||||
|  |  | ||||||
|  |             // if (prefab.CompareTag("Kill")) | ||||||
|  |             // { | ||||||
|  |             Instantiate(Resources.Load<GameObject>("AICollider"), new Vector3(element.x - 1, element.y, 0), Quaternion.identity); | ||||||
|  |             // } | ||||||
|  |  | ||||||
|             Vector3 originalScale = instance.transform.localScale; |             Vector3 originalScale = instance.transform.localScale; | ||||||
|             float newScaleX = element.scaleX > 0 ? element.scaleX : originalScale.x; |             float newScaleX = element.scaleX > 0 ? element.scaleX : originalScale.x; | ||||||
|             float newScaleY = element.scaleY > 0 ? element.scaleY : originalScale.y; |             float newScaleY = element.scaleY > 0 ? element.scaleY : originalScale.y; | ||||||
|   | |||||||
| @@ -24,10 +24,14 @@ public class Player : MonoBehaviour | |||||||
|  |  | ||||||
|         GameObject loaderObj = GameObject.FindGameObjectWithTag("LevelsLoader"); |         GameObject loaderObj = GameObject.FindGameObjectWithTag("LevelsLoader"); | ||||||
|         if (loaderObj != null) |         if (loaderObj != null) | ||||||
|  |         { | ||||||
|             LevelsLoader = loaderObj.GetComponent<LevelsLoader>(); |             LevelsLoader = loaderObj.GetComponent<LevelsLoader>(); | ||||||
|  |         } | ||||||
|         else |         else | ||||||
|  |         { | ||||||
|             Debug.LogWarning("LevelsLoader introuvable : Progression désactivée pour ce niveau."); |             Debug.LogWarning("LevelsLoader introuvable : Progression désactivée pour ce niveau."); | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     public void Start() |     public void Start() | ||||||
|     { |     { | ||||||
| @@ -38,14 +42,34 @@ public class Player : MonoBehaviour | |||||||
|         CurrentGameMode = new NormalGameMode(); |         CurrentGameMode = new NormalGameMode(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public bool IsAI | ||||||
|  |     { | ||||||
|  |         get | ||||||
|  |         { | ||||||
|  |             if (PlayerPrefs.HasKey("AI")) | ||||||
|  |             { | ||||||
|  |                 return PlayerPrefs.GetInt("AI") == 1; | ||||||
|  |             } | ||||||
|  |             else | ||||||
|  |             { | ||||||
|  |                 return false; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         set | ||||||
|  |         { | ||||||
|  |             PlayerPrefs.SetInt("AI", value ? 1 : 0); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     public void Update() |     public void Update() | ||||||
|     { |     { | ||||||
|         if (CurrentGameMode != null) |         CurrentGameMode?.Update(this); | ||||||
|             CurrentGameMode.Update(this); |  | ||||||
|  |  | ||||||
|         if (LevelsLoader != null) |         if (LevelsLoader != null) | ||||||
|  |         { | ||||||
|             LevelsLoader.CalculateCurrentProgressionPercent(transform.position); |             LevelsLoader.CalculateCurrentProgressionPercent(transform.position); | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     public virtual void OnCollisionEnter2D(Collision2D collision) |     public virtual void OnCollisionEnter2D(Collision2D collision) | ||||||
|     { |     { | ||||||
| @@ -79,6 +103,10 @@ public class Player : MonoBehaviour | |||||||
|             SpeedMultiplier /= 1.5f; |             SpeedMultiplier /= 1.5f; | ||||||
|             Destroy(collision.gameObject); |             Destroy(collision.gameObject); | ||||||
|         } |         } | ||||||
|  |         else if (collision.CompareTag("AICollider") && IsAI) | ||||||
|  |         { | ||||||
|  |             CurrentGameMode.Jump(this); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void ChangeGameMode(IGameMode newMode) |     public void ChangeGameMode(IGameMode newMode) | ||||||
|   | |||||||
| @@ -3,12 +3,12 @@ | |||||||
| --- !u!19 &1 | --- !u!19 &1 | ||||||
| Physics2DSettings: | Physics2DSettings: | ||||||
|   m_ObjectHideFlags: 0 |   m_ObjectHideFlags: 0 | ||||||
|   serializedVersion: 5 |   serializedVersion: 6 | ||||||
|   m_Gravity: {x: 0, y: -9.81} |   m_Gravity: {x: 0, y: -9.81} | ||||||
|   m_DefaultMaterial: {fileID: 0} |   m_DefaultMaterial: {fileID: 0} | ||||||
|   m_VelocityIterations: 8 |   m_VelocityIterations: 8 | ||||||
|   m_PositionIterations: 3 |   m_PositionIterations: 3 | ||||||
|   m_VelocityThreshold: 1 |   m_BounceThreshold: 1 | ||||||
|   m_MaxLinearCorrection: 0.2 |   m_MaxLinearCorrection: 0.2 | ||||||
|   m_MaxAngularCorrection: 8 |   m_MaxAngularCorrection: 8 | ||||||
|   m_MaxTranslationSpeed: 100 |   m_MaxTranslationSpeed: 100 | ||||||
| @@ -19,6 +19,7 @@ Physics2DSettings: | |||||||
|   m_LinearSleepTolerance: 0.01 |   m_LinearSleepTolerance: 0.01 | ||||||
|   m_AngularSleepTolerance: 2 |   m_AngularSleepTolerance: 2 | ||||||
|   m_DefaultContactOffset: 0.01 |   m_DefaultContactOffset: 0.01 | ||||||
|  |   m_ContactThreshold: 0 | ||||||
|   m_JobOptions: |   m_JobOptions: | ||||||
|     serializedVersion: 2 |     serializedVersion: 2 | ||||||
|     useMultithreading: 0 |     useMultithreading: 0 | ||||||
| @@ -39,18 +40,17 @@ Physics2DSettings: | |||||||
|     m_IslandSolverBodiesPerJob: 50 |     m_IslandSolverBodiesPerJob: 50 | ||||||
|     m_IslandSolverContactsPerJob: 50 |     m_IslandSolverContactsPerJob: 50 | ||||||
|   m_SimulationMode: 0 |   m_SimulationMode: 0 | ||||||
|  |   m_SimulationLayers: | ||||||
|  |     serializedVersion: 2 | ||||||
|  |     m_Bits: 4294967295 | ||||||
|  |   m_MaxSubStepCount: 4 | ||||||
|  |   m_MinSubStepFPS: 30 | ||||||
|  |   m_UseSubStepping: 0 | ||||||
|  |   m_UseSubStepContacts: 0 | ||||||
|   m_QueriesHitTriggers: 1 |   m_QueriesHitTriggers: 1 | ||||||
|   m_QueriesStartInColliders: 1 |   m_QueriesStartInColliders: 1 | ||||||
|   m_CallbacksOnDisable: 1 |   m_CallbacksOnDisable: 1 | ||||||
|   m_ReuseCollisionCallbacks: 1 |   m_ReuseCollisionCallbacks: 1 | ||||||
|   m_AutoSyncTransforms: 0 |   m_AutoSyncTransforms: 0 | ||||||
|   m_AlwaysShowColliders: 0 |   m_GizmoOptions: 8 | ||||||
|   m_ShowColliderSleep: 1 |  | ||||||
|   m_ShowColliderContacts: 0 |  | ||||||
|   m_ShowColliderAABB: 0 |  | ||||||
|   m_ContactArrowScale: 0.2 |  | ||||||
|   m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} |  | ||||||
|   m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} |  | ||||||
|   m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} |  | ||||||
|   m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} |  | ||||||
|   m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |   m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ TagManager: | |||||||
|   - PortalButtonGroup |   - PortalButtonGroup | ||||||
|   - BonusBoostSpeed |   - BonusBoostSpeed | ||||||
|   - BonusSlowSpeed |   - BonusSlowSpeed | ||||||
|   - Ground |   - AICollider | ||||||
|   layers: |   layers: | ||||||
|   - Default |   - Default | ||||||
|   - TransparentFX |   - TransparentFX | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user