diff --git a/Assets/Data/Units.meta b/Assets/Data/Units.meta new file mode 100644 index 0000000..1c3ea56 --- /dev/null +++ b/Assets/Data/Units.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 50a525946abd59a488fa4d860246a471 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Data/Units/BLOODJOE.asset b/Assets/Data/Units/BLOODJOE.asset new file mode 100644 index 0000000..48fcba2 --- /dev/null +++ b/Assets/Data/Units/BLOODJOE.asset @@ -0,0 +1,16 @@ +%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: 11500000, guid: 6b3a9e9e76344affbc76fb463d95fe74, type: 3} + m_Name: BLOODJOE + m_EditorClassIdentifier: Assembly-CSharp::Data.UnitData + UnitName: BLOOD JOE + MoveSpeed: 0.1 diff --git a/Assets/Data/Units/BLOODJOE.asset.meta b/Assets/Data/Units/BLOODJOE.asset.meta new file mode 100644 index 0000000..e3c7896 --- /dev/null +++ b/Assets/Data/Units/BLOODJOE.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 002caf708abb1144c99ca1048c00afcc +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/InputSystem_Actions.cs b/Assets/InputSystem_Actions.cs index a899440..4112ba8 100644 --- a/Assets/InputSystem_Actions.cs +++ b/Assets/InputSystem_Actions.cs @@ -172,6 +172,15 @@ public partial class @InputControls: IInputActionCollection2, IDisposable ""processors"": """", ""interactions"": """", ""initialStateCheck"": false + }, + { + ""name"": ""Pause"", + ""type"": ""Button"", + ""id"": ""ce6f0bdb-8150-43d4-8aeb-134e15b5c867"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false } ], ""bindings"": [ @@ -559,6 +568,17 @@ public partial class @InputControls: IInputActionCollection2, IDisposable ""action"": ""Crouch"", ""isComposite"": false, ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""e65235e0-3265-472c-b736-66dbd6363247"", + ""path"": """", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Pause"", + ""isComposite"": false, + ""isPartOfComposite"": false } ] }, @@ -1153,6 +1173,7 @@ public partial class @InputControls: IInputActionCollection2, IDisposable m_Player_Previous = m_Player.FindAction("Previous", throwIfNotFound: true); m_Player_Next = m_Player.FindAction("Next", throwIfNotFound: true); m_Player_Sprint = m_Player.FindAction("Sprint", throwIfNotFound: true); + m_Player_Pause = m_Player.FindAction("Pause", throwIfNotFound: true); // UI m_UI = asset.FindActionMap("UI", throwIfNotFound: true); m_UI_Navigate = m_UI.FindAction("Navigate", throwIfNotFound: true); @@ -1255,6 +1276,7 @@ public partial class @InputControls: IInputActionCollection2, IDisposable private readonly InputAction m_Player_Previous; private readonly InputAction m_Player_Next; private readonly InputAction m_Player_Sprint; + private readonly InputAction m_Player_Pause; /// /// Provides access to input actions defined in input action map "Player". /// @@ -1303,6 +1325,10 @@ public partial class @InputControls: IInputActionCollection2, IDisposable /// public InputAction @Sprint => m_Wrapper.m_Player_Sprint; /// + /// Provides access to the underlying input action "Player/Pause". + /// + public InputAction @Pause => m_Wrapper.m_Player_Pause; + /// /// Provides access to the underlying input action map instance. /// public InputActionMap Get() { return m_Wrapper.m_Player; } @@ -1355,6 +1381,9 @@ public partial class @InputControls: IInputActionCollection2, IDisposable @Sprint.started += instance.OnSprint; @Sprint.performed += instance.OnSprint; @Sprint.canceled += instance.OnSprint; + @Pause.started += instance.OnPause; + @Pause.performed += instance.OnPause; + @Pause.canceled += instance.OnPause; } /// @@ -1393,6 +1422,9 @@ public partial class @InputControls: IInputActionCollection2, IDisposable @Sprint.started -= instance.OnSprint; @Sprint.performed -= instance.OnSprint; @Sprint.canceled -= instance.OnSprint; + @Pause.started -= instance.OnPause; + @Pause.performed -= instance.OnPause; + @Pause.canceled -= instance.OnPause; } /// @@ -1756,6 +1788,13 @@ public partial class @InputControls: IInputActionCollection2, IDisposable /// /// void OnSprint(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Pause" is either , or . + /// + /// + /// + /// + void OnPause(InputAction.CallbackContext context); } /// /// Interface to implement callback methods for all input action callbacks associated with input actions defined by "UI" which allows adding and removing callbacks. diff --git a/Assets/InputSystem_Actions.inputactions b/Assets/InputSystem_Actions.inputactions index 1a12cb9..d3db4d9 100644 --- a/Assets/InputSystem_Actions.inputactions +++ b/Assets/InputSystem_Actions.inputactions @@ -1,4 +1,5 @@ { + "version": 1, "name": "InputSystem_Actions", "maps": [ { @@ -85,6 +86,15 @@ "processors": "", "interactions": "", "initialStateCheck": false + }, + { + "name": "Pause", + "type": "Button", + "id": "ce6f0bdb-8150-43d4-8aeb-134e15b5c867", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false } ], "bindings": [ @@ -472,6 +482,17 @@ "action": "Crouch", "isComposite": false, "isPartOfComposite": false + }, + { + "name": "", + "id": "e65235e0-3265-472c-b736-66dbd6363247", + "path": "", + "interactions": "", + "processors": "", + "groups": "", + "action": "Pause", + "isComposite": false, + "isPartOfComposite": false } ] }, diff --git a/Assets/Prefab/Characters/BLOODJOE.prefab b/Assets/Prefab/Characters/BLOODJOE.prefab index 27ab91d..e42fad6 100644 --- a/Assets/Prefab/Characters/BLOODJOE.prefab +++ b/Assets/Prefab/Characters/BLOODJOE.prefab @@ -9,7 +9,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 3636029506242817898} - - component: {fileID: 2117588860408389559} + - component: {fileID: 4543037591913187645} m_Layer: 0 m_Name: BLOODJOE m_TagString: Untagged @@ -33,7 +33,7 @@ Transform: - {fileID: 3717987685648007551} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &2117588860408389559 +--- !u!114 &4543037591913187645 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -42,10 +42,10 @@ MonoBehaviour: m_GameObject: {fileID: 5178305101487608751} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4cefd9a2a7d2ae448bc9bbe40286234e, type: 3} + m_Script: {fileID: 11500000, guid: 9f09fee310742e740b0853ad4366d1b0, type: 3} m_Name: - m_EditorClassIdentifier: Assembly-CSharp::PlayerMovement - speed: 0.05 + m_EditorClassIdentifier: Assembly-CSharp::Pawn + unitData: {fileID: 11400000, guid: 002caf708abb1144c99ca1048c00afcc, type: 2} --- !u!1 &7443273741764524837 GameObject: m_ObjectHideFlags: 0 @@ -74,8 +74,8 @@ Transform: serializedVersion: 2 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_LocalScale: {x: 1.2, y: 1.2, z: 1.2} + m_ConstrainProportionsScale: 1 m_Children: [] m_Father: {fileID: 3636029506242817898} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Prefab/Player.prefab b/Assets/Prefab/Player.prefab new file mode 100644 index 0000000..2545f59 --- /dev/null +++ b/Assets/Prefab/Player.prefab @@ -0,0 +1,103 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2801350755836739254 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 259388946424143483} + - component: {fileID: 5374725762074941630} + - component: {fileID: 5930325806846324897} + - component: {fileID: 6300030663040521374} + - component: {fileID: 1058551726234483551} + m_Layer: 0 + m_Name: Player + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &259388946424143483 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2801350755836739254} + serializedVersion: 2 + 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: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &5374725762074941630 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2801350755836739254} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.PlayerInput + m_Actions: {fileID: -944628639613478452, guid: 2bcd2660ca9b64942af0de543d8d7100, type: 3} + m_NotificationBehavior: 0 + m_UIInputModule: {fileID: 0} + m_DeviceLostEvent: + m_PersistentCalls: + m_Calls: [] + m_DeviceRegainedEvent: + m_PersistentCalls: + m_Calls: [] + m_ControlsChangedEvent: + m_PersistentCalls: + m_Calls: [] + m_ActionEvents: [] + m_NeverAutoSwitchControlSchemes: 0 + m_DefaultControlScheme: + m_DefaultActionMap: Player + m_SplitScreenIndex: -1 + m_Camera: {fileID: 0} +--- !u!114 &5930325806846324897 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2801350755836739254} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 090adb8c34526d44c8084293b7835dfc, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::Player +--- !u!114 &6300030663040521374 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2801350755836739254} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4c7a6df1ceb4769b865dd0e31fb927c, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::Managers.PlayerInputRouter +--- !u!114 &1058551726234483551 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2801350755836739254} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 12c97df4296b47b5be9ee4ac8df0f08f, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::State.PlayerStateMachine.PlayerStateMachine diff --git a/Assets/Prefab/Player.prefab.meta b/Assets/Prefab/Player.prefab.meta new file mode 100644 index 0000000..859704e --- /dev/null +++ b/Assets/Prefab/Player.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 15b524c7b47092648af91b9f0163c227 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Boot.unity b/Assets/Scenes/Boot.unity index 4af0ff3..8d64b1b 100644 --- a/Assets/Scenes/Boot.unity +++ b/Assets/Scenes/Boot.unity @@ -262,6 +262,161 @@ AudioSource: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 +--- !u!1 &1135129241 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1135129243} + - component: {fileID: 1135129242} + - component: {fileID: 1135129244} + m_Layer: 0 + m_Name: PlayerInputManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1135129242 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1135129241} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 621567455fd1c4ceb811cc8a00b6a1a5, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.PlayerInputManager + m_NotificationBehavior: 3 + m_MaxPlayerCount: 2 + m_AllowJoining: 1 + m_JoinBehavior: 1 + m_PlayerJoinedEvent: + m_PersistentCalls: + m_Calls: [] + m_PlayerLeftEvent: + m_PersistentCalls: + m_Calls: [] + m_JoinAction: + m_UseReference: 0 + m_Action: + m_Name: Join + m_Type: 0 + m_ExpectedControlType: + m_Id: 6743169d-f1a9-4e07-bd51-c04f6aad9684 + m_Processors: + m_Interactions: + m_SingletonActionBindings: + - m_Name: + m_Id: 27014fd1-8bd7-482b-b75a-c80560b224f8 + m_Path: /enter + m_Interactions: + m_Processors: + m_Groups: + m_Action: Join + m_Flags: 0 + - m_Name: + m_Id: 78b5b965-1aeb-4a9b-b233-d598d35b7902 + m_Path: /start + m_Interactions: + m_Processors: + m_Groups: + m_Action: Join + m_Flags: 0 + m_Flags: 0 + m_Reference: {fileID: 0} + m_PlayerPrefab: {fileID: 2801350755836739254, guid: 15b524c7b47092648af91b9f0163c227, type: 3} + m_SplitScreen: 0 + m_MaintainAspectRatioInSplitScreen: 0 + m_FixedNumberOfSplitScreens: -1 + m_SplitScreenRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!4 &1135129243 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1135129241} + serializedVersion: 2 + 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: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1135129244 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1135129241} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6c77688db5ee421faec9592570fa3db8, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::Managers.InputManager + stateMachine: {fileID: 1567913722} + playerInputManager: {fileID: 1135129242} + uiModule: {fileID: 0} + characterPrefabs: + - {fileID: 5178305101487608751, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} + - {fileID: 5178305101487608751, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} +--- !u!1 &1567913721 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1567913723} + - component: {fileID: 1567913722} + m_Layer: 0 + m_Name: GameStateMachine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1567913722 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1567913721} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9fba63db359b4b479a0f0a57ab8ea23b, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::State.GameStateMachine.GameStateMachine +--- !u!4 &1567913723 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1567913721} + serializedVersion: 2 + 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: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1695492502 GameObject: m_ObjectHideFlags: 0 @@ -291,7 +446,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8a3740ea238ed9c4a86891b0fecf1c2f, type: 3} m_Name: m_EditorClassIdentifier: - sceneManager: {fileID: 0} + playerJoiner: {fileID: 0} bgm: {fileID: 1072830981} --- !u!4 &1695492504 Transform: @@ -314,3 +469,5 @@ SceneRoots: m_Roots: - {fileID: 1072830980} - {fileID: 1695492504} + - {fileID: 1135129243} + - {fileID: 1567913723} diff --git a/Assets/Scenes/City.unity b/Assets/Scenes/City.unity index d424a3d..e37d7dd 100644 --- a/Assets/Scenes/City.unity +++ b/Assets/Scenes/City.unity @@ -479,79 +479,6 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!1001 &222485703 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 3636029506242817898, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_LocalPosition.x - value: -4.424926 - objectReference: {fileID: 0} - - target: {fileID: 3636029506242817898, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_LocalPosition.y - value: -1.37 - objectReference: {fileID: 0} - - target: {fileID: 3636029506242817898, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3636029506242817898, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3636029506242817898, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3636029506242817898, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3636029506242817898, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3636029506242817898, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3636029506242817898, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3636029506242817898, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3717987685648007551, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_LocalScale.x - value: 1.2 - objectReference: {fileID: 0} - - target: {fileID: 3717987685648007551, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_LocalScale.y - value: 1.2 - objectReference: {fileID: 0} - - target: {fileID: 3717987685648007551, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_LocalScale.z - value: 1.2 - objectReference: {fileID: 0} - - target: {fileID: 3717987685648007551, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_ConstrainProportionsScale - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 5178305101487608751, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} - propertyPath: m_Name - value: BLOODJOE - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 990b0cce140f5964eabc74ee4b0fde11, type: 3} --- !u!1 &232652745 GameObject: m_ObjectHideFlags: 0 @@ -5394,4 +5321,3 @@ SceneRoots: - {fileID: 2141805247} - {fileID: 1252944905} - {fileID: 1553743613} - - {fileID: 222485703} diff --git a/Assets/Scripts/Data.meta b/Assets/Scripts/Data.meta new file mode 100644 index 0000000..94ff67e --- /dev/null +++ b/Assets/Scripts/Data.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 380f2e10c9e9c9a4996f41a832c41f8b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Data/Level.cs b/Assets/Scripts/Data/Level.cs new file mode 100644 index 0000000..e78ed82 --- /dev/null +++ b/Assets/Scripts/Data/Level.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +namespace Data +{ + [CreateAssetMenu(menuName = "Level")] + public class Level : ScriptableObject + { + public AudioClip BGM => bgm; + public string SceneName => sceneName; + + [SerializeField] private AudioClip bgm; + [SerializeField] private string sceneName; + } +} diff --git a/Assets/Scripts/Level.cs.meta b/Assets/Scripts/Data/Level.cs.meta similarity index 100% rename from Assets/Scripts/Level.cs.meta rename to Assets/Scripts/Data/Level.cs.meta diff --git a/Assets/Scripts/Data/UnitData.cs b/Assets/Scripts/Data/UnitData.cs new file mode 100644 index 0000000..c6c45f4 --- /dev/null +++ b/Assets/Scripts/Data/UnitData.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +namespace Data +{ + [CreateAssetMenu(menuName = "UnitData")] + public class UnitData : ScriptableObject + { + public string UnitName; + public float MoveSpeed; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Data/UnitData.cs.meta b/Assets/Scripts/Data/UnitData.cs.meta new file mode 100644 index 0000000..493d0b3 --- /dev/null +++ b/Assets/Scripts/Data/UnitData.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6b3a9e9e76344affbc76fb463d95fe74 +timeCreated: 1755290497 \ No newline at end of file diff --git a/Assets/Scripts/Level.cs b/Assets/Scripts/Level.cs deleted file mode 100644 index dd8bf02..0000000 --- a/Assets/Scripts/Level.cs +++ /dev/null @@ -1,11 +0,0 @@ -using UnityEngine; - -[CreateAssetMenu(menuName = "Level")] -public class Level : ScriptableObject -{ - public AudioClip BGM => bgm; - public string SceneName => sceneName; - - [SerializeField] private AudioClip bgm; - [SerializeField] private string sceneName; -} diff --git a/Assets/Scripts/Managers/PlayerInputRouter.cs b/Assets/Scripts/Managers/PlayerInputRouter.cs new file mode 100644 index 0000000..5f75416 --- /dev/null +++ b/Assets/Scripts/Managers/PlayerInputRouter.cs @@ -0,0 +1,66 @@ +using System; +using State; +using State.PlayerStateMachine; +using UnityEngine; +using UnityEngine.InputSystem; + +namespace Managers +{ + [RequireComponent(typeof(PlayerInput))] + public class PlayerInputRouter : MonoBehaviour + { + private PlayerInput _playerInput; + private PlayerStateMachine _playerStateMachine; + private InputActionMap _map; + + private void Awake() + { + _playerInput = GetComponent(); + _playerStateMachine = GetComponent(); + _map = _playerInput.actions.FindActionMap("Player", throwIfNotFound: true); + } + + private void OnEnable() + { + _map["Move"].performed += OnMovePerformed; + _map["Move"].canceled += OnMoveCanceled; + _map["Attack"].performed += OnAttackPerformed; + _map["Jump"].performed += OnJumpPerformed; + _map["Pause"].performed += OnPausePerformed; + } + + private void OnDisable() + { + _map["Move"].performed -= OnMovePerformed; + _map["Move"].canceled -= OnMoveCanceled; + _map["Attack"].performed -= OnAttackPerformed; + _map["Jump"].performed -= OnJumpPerformed; + _map["Pause"].performed -= OnPausePerformed; + } + + private void OnJumpPerformed(InputAction.CallbackContext obj) + { + _playerStateMachine.Issue(GameState.Command.Jump); + } + + private void OnPausePerformed(InputAction.CallbackContext obj) + { + throw new NotImplementedException(); + } + + private void OnAttackPerformed(InputAction.CallbackContext obj) + { + _playerStateMachine.Issue(GameState.Command.Attack); + } + + private void OnMoveCanceled(InputAction.CallbackContext obj) + { + _playerStateMachine.SetMove(Vector2.zero); + } + + private void OnMovePerformed(InputAction.CallbackContext obj) + { + _playerStateMachine.SetMove(obj.ReadValue()); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Managers/PlayerInputRouter.cs.meta b/Assets/Scripts/Managers/PlayerInputRouter.cs.meta new file mode 100644 index 0000000..bafc7c8 --- /dev/null +++ b/Assets/Scripts/Managers/PlayerInputRouter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f4c7a6df1ceb4769b865dd0e31fb927c +timeCreated: 1755284785 \ No newline at end of file diff --git a/Assets/Scripts/Managers/PlayerJoiner.cs b/Assets/Scripts/Managers/PlayerJoiner.cs new file mode 100644 index 0000000..4e9b054 --- /dev/null +++ b/Assets/Scripts/Managers/PlayerJoiner.cs @@ -0,0 +1,121 @@ +using System.Collections.Generic; +using State; +using State.GameStateMachine; +using State.PlayerStateMachine; +using UnityEngine; +using UnityEngine.InputSystem; +using UnityEngine.InputSystem.UI; + +namespace Managers +{ + public class PlayerJoiner : MonoBehaviour + { + [SerializeField] private GameStateMachine stateMachine; + [SerializeField] private PlayerInputManager playerInputManager; + [SerializeField] private InputSystemUIInputModule uiModule; + [SerializeField] private GameObject[] characterPrefabs = new GameObject[2]; + + + private readonly List _players = new(); + private PlayerInput _currentUIOwner; + + private void OnEnable() + { + playerInputManager.onPlayerJoined += HandlePlayerJoined; + playerInputManager.onPlayerLeft += HandlePlayerLeft; + stateMachine.OnStateChange += HandleStateChanged; + } + + private void OnDisable() + { + playerInputManager.onPlayerJoined -= HandlePlayerJoined; + playerInputManager.onPlayerLeft -= HandlePlayerLeft; + stateMachine.OnStateChange -= HandleStateChanged; + } + + private void HandleStateChanged(GameState newState) + { + switch (newState) + { + case MainMenu: + EnableUIFor(null); + break; + case PlayLevel: + EnableActionMaps(true); + break; + case Paused: + break; + default: + break; + } + } + + private void HandlePlayerJoined(PlayerInput playerInput) + { + Debug.Log("Player joined!"); + _players.Add(playerInput); + + // TODO: Move all of this to a player spawner + var character = Instantiate(characterPrefabs[_players.Count - 1]); + var playerStateMachine = playerInput.gameObject.GetComponent(); + playerStateMachine.controlledPawn = character.GetComponent(); + playerInput.actions.Enable(); + } + + private void HandlePlayerLeft(PlayerInput playerInput) + { + _players.Remove(playerInput); + if(_currentUIOwner == playerInput) _currentUIOwner = null; + } + + private void EnableUIFor(PlayerInput owner) + { + _currentUIOwner = owner; + var asset = uiModule.actionsAsset; + if (owner == null) + { + asset.devices = null; // any device can drive UI (boot) + asset.bindingMask = null; + } + else + { + asset.devices = owner.devices; // owner's paired devices only + asset.bindingMask = InputBinding.MaskByGroup(owner.currentControlScheme); + } + + // Ensure UI actions are enabled + asset.FindActionMap("UI", true).Enable(); + } + + private void EnableActionMaps(bool gameplayEnabled) + { + foreach (var p in _players) + { + if (gameplayEnabled) + { + p.ActivateInput(); + if (p.currentActionMap?.name != "Player") + p.SwitchCurrentActionMap("Player"); + } + else + { + p.DeactivateInput(); // disables player actions, keeps device pairing + } + } + } + + private void ReleaseUIFocus() + { + var asset = uiModule.actionsAsset; + asset.devices = null; + asset.bindingMask = null; + _currentUIOwner = null; + } + + // Called by UI Button (Resume) or router "Back" when paused. + public void ResumeFromPause() + { + stateMachine.ChangeState(new PlayLevel()); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Managers/PlayerJoiner.cs.meta b/Assets/Scripts/Managers/PlayerJoiner.cs.meta new file mode 100644 index 0000000..dc46312 --- /dev/null +++ b/Assets/Scripts/Managers/PlayerJoiner.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6c77688db5ee421faec9592570fa3db8 +timeCreated: 1755234020 \ No newline at end of file diff --git a/Assets/Scripts/Managers/SceneManager.cs b/Assets/Scripts/Managers/SceneManager.cs deleted file mode 100644 index f08bfb2..0000000 --- a/Assets/Scripts/Managers/SceneManager.cs +++ /dev/null @@ -1,9 +0,0 @@ -using UnityEngine; - -namespace Managers -{ - public class SceneManager : MonoBehaviour - { - - } -} diff --git a/Assets/Scripts/Managers/SceneManager.cs.meta b/Assets/Scripts/Managers/SceneManager.cs.meta deleted file mode 100644 index 2fa7a53..0000000 --- a/Assets/Scripts/Managers/SceneManager.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 544fd6c0f88f7f647bd2ed389d8e3747 \ No newline at end of file diff --git a/Assets/Scripts/Managers/Services.cs b/Assets/Scripts/Managers/Services.cs index 14f659e..3fb0817 100644 --- a/Assets/Scripts/Managers/Services.cs +++ b/Assets/Scripts/Managers/Services.cs @@ -1,4 +1,5 @@ using UnityEngine; +using UnityEngine.Serialization; namespace Managers { @@ -6,10 +7,10 @@ namespace Managers { public static Services Instance { get; private set; } - public SceneManager SceneManager => sceneManager; + public PlayerJoiner PlayerJoiner => playerJoiner; public BGM BGM => bgm; - [SerializeField] private SceneManager sceneManager; + [FormerlySerializedAs("inputCoordinator")] [FormerlySerializedAs("inputManager")] [FormerlySerializedAs("inputRouter")] [SerializeField] private PlayerJoiner playerJoiner; [SerializeField] private BGM bgm; public void Awake() diff --git a/Assets/Scripts/Pawn.cs b/Assets/Scripts/Pawn.cs new file mode 100644 index 0000000..d326913 --- /dev/null +++ b/Assets/Scripts/Pawn.cs @@ -0,0 +1,19 @@ +using System; +using Data; +using UnityEngine; + +public class Pawn : MonoBehaviour +{ + [SerializeField] private UnitData unitData; + private Vector2 _moveInput; + + public virtual void HandleMove(Vector2 input) + { + _moveInput = input; + } + + private void FixedUpdate() + { + transform.Translate(_moveInput * unitData.MoveSpeed); + } +} diff --git a/Assets/Scripts/Pawn.cs.meta b/Assets/Scripts/Pawn.cs.meta new file mode 100644 index 0000000..0d77b4f --- /dev/null +++ b/Assets/Scripts/Pawn.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9f09fee310742e740b0853ad4366d1b0 \ No newline at end of file diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs new file mode 100644 index 0000000..256e1c3 --- /dev/null +++ b/Assets/Scripts/Player.cs @@ -0,0 +1,12 @@ +using System; +using UnityEngine; +using UnityEngine.InputSystem; + +[RequireComponent(typeof(PlayerInput))] +public class Player : MonoBehaviour +{ + private void Awake() + { + DontDestroyOnLoad(gameObject); + } +} diff --git a/Assets/Scripts/Player.cs.meta b/Assets/Scripts/Player.cs.meta new file mode 100644 index 0000000..c405acb --- /dev/null +++ b/Assets/Scripts/Player.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 090adb8c34526d44c8084293b7835dfc \ No newline at end of file diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs deleted file mode 100644 index 9e0e151..0000000 --- a/Assets/Scripts/PlayerMovement.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using UnityEngine; - -public class PlayerMovement : MonoBehaviour -{ - private InputControls _controls; - private Vector2 _input; - - [SerializeField] private float speed; - - // Start is called once before the first execution of Update after the MonoBehaviour is created - void Start() - { - _controls = new InputControls(); - _controls.Enable(); - } - - // Update is called once per frame - void Update() - { - _input = _controls.Player.Move.ReadValue(); - } - - private void FixedUpdate() - { - transform.Translate(_input.normalized * speed); - } -} diff --git a/Assets/Scripts/PlayerMovement.cs.meta b/Assets/Scripts/PlayerMovement.cs.meta deleted file mode 100644 index 2dfe580..0000000 --- a/Assets/Scripts/PlayerMovement.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 4cefd9a2a7d2ae448bc9bbe40286234e \ No newline at end of file diff --git a/Assets/Scripts/State.meta b/Assets/Scripts/State.meta new file mode 100644 index 0000000..44da007 --- /dev/null +++ b/Assets/Scripts/State.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b780695be93947ac9b3651fa1fa5b9a2 +timeCreated: 1755232332 \ No newline at end of file diff --git a/Assets/Scripts/State/GameState.cs b/Assets/Scripts/State/GameState.cs new file mode 100644 index 0000000..51663e7 --- /dev/null +++ b/Assets/Scripts/State/GameState.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace State +{ + public abstract class GameState + { + public enum Command { Attack, Jump, Pause } + protected StateMachine StateMachine; + public virtual void OnEnter(StateMachine machine) + { + StateMachine = machine; + } + + public virtual void OnExit() { } + + public virtual void Update() { } + + public virtual void Handle(Command command) { } + + public virtual void Handle(Vector2 input) { } + } +} \ No newline at end of file diff --git a/Assets/Scripts/State/GameState.cs.meta b/Assets/Scripts/State/GameState.cs.meta new file mode 100644 index 0000000..2545e5b --- /dev/null +++ b/Assets/Scripts/State/GameState.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 035addff692543a3909f214ea76461c0 +timeCreated: 1755232317 \ No newline at end of file diff --git a/Assets/Scripts/State/GameStateMachine.meta b/Assets/Scripts/State/GameStateMachine.meta new file mode 100644 index 0000000..45a370b --- /dev/null +++ b/Assets/Scripts/State/GameStateMachine.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 94796da2a3a245ffb93288868610223e +timeCreated: 1755232596 \ No newline at end of file diff --git a/Assets/Scripts/State/GameStateMachine/Cutscene.cs b/Assets/Scripts/State/GameStateMachine/Cutscene.cs new file mode 100644 index 0000000..c1be21c --- /dev/null +++ b/Assets/Scripts/State/GameStateMachine/Cutscene.cs @@ -0,0 +1,15 @@ +namespace State.GameStateMachine +{ + public class Cutscene : GameState + { + public override void OnExit() + { + throw new System.NotImplementedException(); + } + + public override void Update() + { + throw new System.NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/State/GameStateMachine/Cutscene.cs.meta b/Assets/Scripts/State/GameStateMachine/Cutscene.cs.meta new file mode 100644 index 0000000..400fceb --- /dev/null +++ b/Assets/Scripts/State/GameStateMachine/Cutscene.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5d6e5eb837674ccbb4391603ca4fecce +timeCreated: 1755233147 \ No newline at end of file diff --git a/Assets/Scripts/State/GameStateMachine/GameStateMachine.cs b/Assets/Scripts/State/GameStateMachine/GameStateMachine.cs new file mode 100644 index 0000000..32ffe36 --- /dev/null +++ b/Assets/Scripts/State/GameStateMachine/GameStateMachine.cs @@ -0,0 +1,12 @@ +using UnityEngine; + +namespace State.GameStateMachine +{ + public class GameStateMachine : StateMachine + { + public void Init() + { + + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/State/GameStateMachine/GameStateMachine.cs.meta b/Assets/Scripts/State/GameStateMachine/GameStateMachine.cs.meta new file mode 100644 index 0000000..c8aa8be --- /dev/null +++ b/Assets/Scripts/State/GameStateMachine/GameStateMachine.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9fba63db359b4b479a0f0a57ab8ea23b +timeCreated: 1755232794 \ No newline at end of file diff --git a/Assets/Scripts/State/GameStateMachine/MainMenu.cs b/Assets/Scripts/State/GameStateMachine/MainMenu.cs new file mode 100644 index 0000000..8523ee1 --- /dev/null +++ b/Assets/Scripts/State/GameStateMachine/MainMenu.cs @@ -0,0 +1,15 @@ +namespace State.GameStateMachine +{ + public class MainMenu : GameState + { + public override void OnExit() + { + throw new System.NotImplementedException(); + } + + public override void Update() + { + throw new System.NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/State/GameStateMachine/MainMenu.cs.meta b/Assets/Scripts/State/GameStateMachine/MainMenu.cs.meta new file mode 100644 index 0000000..2f6cba4 --- /dev/null +++ b/Assets/Scripts/State/GameStateMachine/MainMenu.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e9325a9be1a54d94affa8809cab91493 +timeCreated: 1755283250 \ No newline at end of file diff --git a/Assets/Scripts/State/GameStateMachine/Paused.cs b/Assets/Scripts/State/GameStateMachine/Paused.cs new file mode 100644 index 0000000..d11d0dc --- /dev/null +++ b/Assets/Scripts/State/GameStateMachine/Paused.cs @@ -0,0 +1,15 @@ +namespace State.GameStateMachine +{ + public class Paused : GameState + { + public override void OnExit() + { + throw new System.NotImplementedException(); + } + + public override void Update() + { + throw new System.NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/State/GameStateMachine/Paused.cs.meta b/Assets/Scripts/State/GameStateMachine/Paused.cs.meta new file mode 100644 index 0000000..b1eea67 --- /dev/null +++ b/Assets/Scripts/State/GameStateMachine/Paused.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e9beb186523341e5a902cbb6532fc0dd +timeCreated: 1755283304 \ No newline at end of file diff --git a/Assets/Scripts/State/GameStateMachine/PlayLevel.cs b/Assets/Scripts/State/GameStateMachine/PlayLevel.cs new file mode 100644 index 0000000..764935e --- /dev/null +++ b/Assets/Scripts/State/GameStateMachine/PlayLevel.cs @@ -0,0 +1,20 @@ +namespace State.GameStateMachine +{ + public class PlayLevel : GameState + { + public override void OnEnter(StateMachine machine) + { + base.OnEnter(machine); + } + + public override void OnExit() + { + throw new System.NotImplementedException(); + } + + public override void Update() + { + throw new System.NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/State/GameStateMachine/PlayLevel.cs.meta b/Assets/Scripts/State/GameStateMachine/PlayLevel.cs.meta new file mode 100644 index 0000000..8291860 --- /dev/null +++ b/Assets/Scripts/State/GameStateMachine/PlayLevel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3b2aa235764e43fe9dc7b8065d3e6711 +timeCreated: 1755232664 \ No newline at end of file diff --git a/Assets/Scripts/State/PlayerStateMachine.meta b/Assets/Scripts/State/PlayerStateMachine.meta new file mode 100644 index 0000000..420ad0b --- /dev/null +++ b/Assets/Scripts/State/PlayerStateMachine.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e3129febb48e4260a4a30eea4cd4e11f +timeCreated: 1755285675 \ No newline at end of file diff --git a/Assets/Scripts/State/PlayerStateMachine/Idle.cs b/Assets/Scripts/State/PlayerStateMachine/Idle.cs new file mode 100644 index 0000000..385dc08 --- /dev/null +++ b/Assets/Scripts/State/PlayerStateMachine/Idle.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +namespace State.PlayerStateMachine +{ + public class Idle : GameState + { + public override void Handle(Vector2 input) + { + base.Handle(input); + ((PlayerStateMachine)StateMachine).controlledPawn.HandleMove(input); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/State/PlayerStateMachine/Idle.cs.meta b/Assets/Scripts/State/PlayerStateMachine/Idle.cs.meta new file mode 100644 index 0000000..8f4a47a --- /dev/null +++ b/Assets/Scripts/State/PlayerStateMachine/Idle.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b19fd86c3d7742ba96901825856abc47 +timeCreated: 1755290059 \ No newline at end of file diff --git a/Assets/Scripts/State/PlayerStateMachine/PlayerStateMachine.cs b/Assets/Scripts/State/PlayerStateMachine/PlayerStateMachine.cs new file mode 100644 index 0000000..a0feee0 --- /dev/null +++ b/Assets/Scripts/State/PlayerStateMachine/PlayerStateMachine.cs @@ -0,0 +1,21 @@ +using System; +using UnityEngine; + +namespace State.PlayerStateMachine +{ + public class PlayerStateMachine : StateMachine + { + public Pawn controlledPawn; + public void Issue(GameState.Command command) => CurrentState?.Handle(command); + public void SetMove(Vector2 input) + { + Debug.Log(input); + CurrentState?.Handle(input); + } + + private void Awake() + { + ChangeState(new Idle()); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/State/PlayerStateMachine/PlayerStateMachine.cs.meta b/Assets/Scripts/State/PlayerStateMachine/PlayerStateMachine.cs.meta new file mode 100644 index 0000000..43b0a09 --- /dev/null +++ b/Assets/Scripts/State/PlayerStateMachine/PlayerStateMachine.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 12c97df4296b47b5be9ee4ac8df0f08f +timeCreated: 1755285683 \ No newline at end of file diff --git a/Assets/Scripts/State/StateMachine.cs b/Assets/Scripts/State/StateMachine.cs new file mode 100644 index 0000000..83b31ec --- /dev/null +++ b/Assets/Scripts/State/StateMachine.cs @@ -0,0 +1,24 @@ +using System; +using UnityEngine; + +namespace State +{ + public class StateMachine : MonoBehaviour + { + public event Action OnStateChange; + protected GameState CurrentState; + + public void ChangeState(GameState newState) + { + CurrentState?.OnExit(); + CurrentState = newState; + CurrentState?.OnEnter(this); + OnStateChange?.Invoke(CurrentState); + } + + private void Update() + { + CurrentState?.Update(); + } + } +} diff --git a/Assets/Scripts/State/StateMachine.cs.meta b/Assets/Scripts/State/StateMachine.cs.meta new file mode 100644 index 0000000..5db1235 --- /dev/null +++ b/Assets/Scripts/State/StateMachine.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 95ec47d6e54a58f47990e8b4d49ad277 \ No newline at end of file diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index ef8b2dd..c85eb75 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -8,6 +8,5 @@ EditorBuildSettings: - enabled: 1 path: Assets/Scenes/MainMenu.unity guid: 8c9cfa26abfee488c85f1582747f6a02 - m_configObjects: - com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 2bcd2660ca9b64942af0de543d8d7100, type: 3} + m_configObjects: {} m_UseUCBPForAssetBundles: 0