diff --git a/Assets/Input System/InputControl.cs b/Assets/Input System/InputControl.cs index abb1a0f6467221b899b1db39e930c08193360687..1721bcc14fc4a6451cf7b233cb0db63f719486da 100644 --- a/Assets/Input System/InputControl.cs +++ b/Assets/Input System/InputControl.cs @@ -71,6 +71,51 @@ public partial class @InputControl : IInputActionCollection2, IDisposable ""processors"": """", ""interactions"": """", ""initialStateCheck"": false + }, + { + ""name"": ""Weapon1"", + ""type"": ""Button"", + ""id"": ""94d83d3c-00bf-4e89-b03f-ece53a3d4bbd"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Weapon2"", + ""type"": ""Button"", + ""id"": ""5010c62f-c310-4b0c-b49e-0849dc2a8e33"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Weapon3"", + ""type"": ""Button"", + ""id"": ""26bb5b3d-12f6-4e9b-b94f-f135fa8d6956"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Weapon4"", + ""type"": ""Button"", + ""id"": ""c1d4ec21-1c62-49ef-b296-9f295136751c"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""WeaponScroll"", + ""type"": ""PassThrough"", + ""id"": ""d1051e53-5f93-4997-a49c-b906e5986df3"", + ""expectedControlType"": ""Axis"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false } ], ""bindings"": [ @@ -172,6 +217,61 @@ public partial class @InputControl : IInputActionCollection2, IDisposable ""action"": ""Shop"", ""isComposite"": false, ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""60c22da2-c9ef-4321-a54b-0938ba2499cd"", + ""path"": ""<Keyboard>/1"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Weapon1"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""6b6ef226-025e-4b63-a81f-5ea2168f3c37"", + ""path"": ""<Keyboard>/2"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Weapon2"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""50db62c6-ac96-4571-a5ce-b8055b74ecdc"", + ""path"": ""<Keyboard>/3"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Weapon3"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""6bccaa82-6385-4e81-85ed-270876b3de70"", + ""path"": ""<Keyboard>/4"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Weapon4"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""34348491-a8cf-4d4d-a0e8-4449e98bc02a"", + ""path"": ""<Mouse>/scroll"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""WeaponScroll"", + ""isComposite"": false, + ""isPartOfComposite"": false } ] } @@ -197,6 +297,11 @@ public partial class @InputControl : IInputActionCollection2, IDisposable m_Player_ToggleDebug = m_Player.FindAction("ToggleDebug", throwIfNotFound: true); m_Player_Return = m_Player.FindAction("Return", throwIfNotFound: true); m_Player_Shop = m_Player.FindAction("Shop", throwIfNotFound: true); + m_Player_Weapon1 = m_Player.FindAction("Weapon1", throwIfNotFound: true); + m_Player_Weapon2 = m_Player.FindAction("Weapon2", throwIfNotFound: true); + m_Player_Weapon3 = m_Player.FindAction("Weapon3", throwIfNotFound: true); + m_Player_Weapon4 = m_Player.FindAction("Weapon4", throwIfNotFound: true); + m_Player_WeaponScroll = m_Player.FindAction("WeaponScroll", throwIfNotFound: true); } public void Dispose() @@ -261,6 +366,11 @@ public partial class @InputControl : IInputActionCollection2, IDisposable private readonly InputAction m_Player_ToggleDebug; private readonly InputAction m_Player_Return; private readonly InputAction m_Player_Shop; + private readonly InputAction m_Player_Weapon1; + private readonly InputAction m_Player_Weapon2; + private readonly InputAction m_Player_Weapon3; + private readonly InputAction m_Player_Weapon4; + private readonly InputAction m_Player_WeaponScroll; public struct PlayerActions { private @InputControl m_Wrapper; @@ -270,6 +380,11 @@ public partial class @InputControl : IInputActionCollection2, IDisposable public InputAction @ToggleDebug => m_Wrapper.m_Player_ToggleDebug; public InputAction @Return => m_Wrapper.m_Player_Return; public InputAction @Shop => m_Wrapper.m_Player_Shop; + public InputAction @Weapon1 => m_Wrapper.m_Player_Weapon1; + public InputAction @Weapon2 => m_Wrapper.m_Player_Weapon2; + public InputAction @Weapon3 => m_Wrapper.m_Player_Weapon3; + public InputAction @Weapon4 => m_Wrapper.m_Player_Weapon4; + public InputAction @WeaponScroll => m_Wrapper.m_Player_WeaponScroll; public InputActionMap Get() { return m_Wrapper.m_Player; } public void Enable() { Get().Enable(); } public void Disable() { Get().Disable(); } @@ -294,6 +409,21 @@ public partial class @InputControl : IInputActionCollection2, IDisposable @Shop.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnShop; @Shop.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnShop; @Shop.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnShop; + @Weapon1.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeapon1; + @Weapon1.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeapon1; + @Weapon1.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeapon1; + @Weapon2.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeapon2; + @Weapon2.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeapon2; + @Weapon2.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeapon2; + @Weapon3.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeapon3; + @Weapon3.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeapon3; + @Weapon3.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeapon3; + @Weapon4.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeapon4; + @Weapon4.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeapon4; + @Weapon4.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeapon4; + @WeaponScroll.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeaponScroll; + @WeaponScroll.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeaponScroll; + @WeaponScroll.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWeaponScroll; } m_Wrapper.m_PlayerActionsCallbackInterface = instance; if (instance != null) @@ -313,6 +443,21 @@ public partial class @InputControl : IInputActionCollection2, IDisposable @Shop.started += instance.OnShop; @Shop.performed += instance.OnShop; @Shop.canceled += instance.OnShop; + @Weapon1.started += instance.OnWeapon1; + @Weapon1.performed += instance.OnWeapon1; + @Weapon1.canceled += instance.OnWeapon1; + @Weapon2.started += instance.OnWeapon2; + @Weapon2.performed += instance.OnWeapon2; + @Weapon2.canceled += instance.OnWeapon2; + @Weapon3.started += instance.OnWeapon3; + @Weapon3.performed += instance.OnWeapon3; + @Weapon3.canceled += instance.OnWeapon3; + @Weapon4.started += instance.OnWeapon4; + @Weapon4.performed += instance.OnWeapon4; + @Weapon4.canceled += instance.OnWeapon4; + @WeaponScroll.started += instance.OnWeaponScroll; + @WeaponScroll.performed += instance.OnWeaponScroll; + @WeaponScroll.canceled += instance.OnWeaponScroll; } } } @@ -333,5 +478,10 @@ public partial class @InputControl : IInputActionCollection2, IDisposable void OnToggleDebug(InputAction.CallbackContext context); void OnReturn(InputAction.CallbackContext context); void OnShop(InputAction.CallbackContext context); + void OnWeapon1(InputAction.CallbackContext context); + void OnWeapon2(InputAction.CallbackContext context); + void OnWeapon3(InputAction.CallbackContext context); + void OnWeapon4(InputAction.CallbackContext context); + void OnWeaponScroll(InputAction.CallbackContext context); } } diff --git a/Assets/Input System/InputControl.inputactions b/Assets/Input System/InputControl.inputactions index a72e2a4a202865c9db4e212ca4c6040fdcfc9660..8cb38ff4810a20f531e3eccad13be7a347f3b54b 100644 --- a/Assets/Input System/InputControl.inputactions +++ b/Assets/Input System/InputControl.inputactions @@ -49,6 +49,51 @@ "processors": "", "interactions": "", "initialStateCheck": false + }, + { + "name": "Weapon1", + "type": "Button", + "id": "94d83d3c-00bf-4e89-b03f-ece53a3d4bbd", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Weapon2", + "type": "Button", + "id": "5010c62f-c310-4b0c-b49e-0849dc2a8e33", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Weapon3", + "type": "Button", + "id": "26bb5b3d-12f6-4e9b-b94f-f135fa8d6956", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Weapon4", + "type": "Button", + "id": "c1d4ec21-1c62-49ef-b296-9f295136751c", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "WeaponScroll", + "type": "PassThrough", + "id": "d1051e53-5f93-4997-a49c-b906e5986df3", + "expectedControlType": "Axis", + "processors": "", + "interactions": "", + "initialStateCheck": false } ], "bindings": [ @@ -150,6 +195,61 @@ "action": "Shop", "isComposite": false, "isPartOfComposite": false + }, + { + "name": "", + "id": "60c22da2-c9ef-4321-a54b-0938ba2499cd", + "path": "<Keyboard>/1", + "interactions": "", + "processors": "", + "groups": "", + "action": "Weapon1", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "6b6ef226-025e-4b63-a81f-5ea2168f3c37", + "path": "<Keyboard>/2", + "interactions": "", + "processors": "", + "groups": "", + "action": "Weapon2", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "50db62c6-ac96-4571-a5ce-b8055b74ecdc", + "path": "<Keyboard>/3", + "interactions": "", + "processors": "", + "groups": "", + "action": "Weapon3", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "6bccaa82-6385-4e81-85ed-270876b3de70", + "path": "<Keyboard>/4", + "interactions": "", + "processors": "", + "groups": "", + "action": "Weapon4", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "34348491-a8cf-4d4d-a0e8-4449e98bc02a", + "path": "<Mouse>/scroll", + "interactions": "", + "processors": "", + "groups": "", + "action": "WeaponScroll", + "isComposite": false, + "isPartOfComposite": false } ] } diff --git a/Assets/Prefabs/Player/Player.prefab b/Assets/Prefabs/Player/Player.prefab index f4727c1f6570fe9eb3b28887b9510195baea7591..e0ed39af66157ecac2f5927116e94a599e30d171 100644 --- a/Assets/Prefabs/Player/Player.prefab +++ b/Assets/Prefabs/Player/Player.prefab @@ -10658,3 +10658,65 @@ Transform: m_CorrespondingSourceObject: {fileID: 2438527259672530295, guid: 26b39247874858f4b810f01ae22bdd1b, type: 3} m_PrefabInstance: {fileID: 7986664158611116515} m_PrefabAsset: {fileID: 0} +--- !u!1001 &8144377965125707309 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 2919655767763995930} + m_Modifications: + - target: {fileID: 1550041344122329040, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1550041344122329040, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1550041344122329040, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1550041344122329040, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1550041344122329040, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1550041344122329040, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1550041344122329040, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1550041344122329040, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1550041344122329040, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1550041344122329040, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1550041344122329040, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8604093213059675828, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} + propertyPath: m_Name + value: WeaponHolder + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} +--- !u!4 &7243053704608395773 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 1550041344122329040, guid: 412cc1b5b88232a40b36e971b934d07e, type: 3} + m_PrefabInstance: {fileID: 8144377965125707309} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefabs/Weapon/WeaponHolder.prefab b/Assets/Prefabs/Weapon/WeaponHolder.prefab index a5d7126011b8b617424c7418b51c4098fb555944..5212a83f5faf76aa7bc67d9676b8b6720e53bb21 100644 --- a/Assets/Prefabs/Weapon/WeaponHolder.prefab +++ b/Assets/Prefabs/Weapon/WeaponHolder.prefab @@ -10,6 +10,7 @@ GameObject: m_Component: - component: {fileID: 1550041344122329040} - component: {fileID: 8211412517785425155} + - component: {fileID: 8869846314709014593} m_Layer: 0 m_Name: WeaponHolder m_TagString: Untagged @@ -48,7 +49,126 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 22ad43701c81f264abc2261069bd3bed, type: 3} m_Name: m_EditorClassIdentifier: + changeWeaponCooldown: 0.1 selectedWeapon: 0 +--- !u!114 &8869846314709014593 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8604093213059675828} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Actions: {fileID: -944628639613478452, guid: 6be9b607b0c10474289d38e1c65b137f, type: 3} + m_NotificationBehavior: 2 + 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_PersistentCalls: + m_Calls: [] + m_ActionId: 99c57b86-d68e-49bf-b85c-18188cdd44d9 + m_ActionName: Player/Move[/Keyboard/w,/Keyboard/s,/Keyboard/a,/Keyboard/d] + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 50060af3-b3cd-4911-b80b-c065951aa126 + m_ActionName: Player/Fire[/Mouse/leftButton] + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 0fc7338e-a317-4ae4-a551-04386105fd20 + m_ActionName: Player/ToggleDebug[/Keyboard/backquote] + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 3cffb8d7-dbf0-4325-9972-0ebd19c73b37 + m_ActionName: Player/Return[/Keyboard/enter] + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 437a7a6f-9108-4ff2-80eb-523f7a537e73 + m_ActionName: Player/Shop[/Keyboard/f] + - m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 8211412517785425155} + m_TargetAssemblyTypeName: WeaponController, Assembly-CSharp + m_MethodName: onWeapon1Chosen + m_Mode: 0 + 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_ActionId: 94d83d3c-00bf-4e89-b03f-ece53a3d4bbd + m_ActionName: Player/Weapon1[/Keyboard/1] + - m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 8211412517785425155} + m_TargetAssemblyTypeName: WeaponController, Assembly-CSharp + m_MethodName: onWeapon2Chosen + m_Mode: 0 + 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_ActionId: 5010c62f-c310-4b0c-b49e-0849dc2a8e33 + m_ActionName: Player/Weapon2[/Keyboard/2] + - m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 8211412517785425155} + m_TargetAssemblyTypeName: WeaponController, Assembly-CSharp + m_MethodName: onWeapon3Chosen + m_Mode: 0 + 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_ActionId: 26bb5b3d-12f6-4e9b-b94f-f135fa8d6956 + m_ActionName: Player/Weapon3[/Keyboard/3] + - m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 8211412517785425155} + m_TargetAssemblyTypeName: WeaponController, Assembly-CSharp + m_MethodName: onWeapon4Chosen + m_Mode: 0 + 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_ActionId: c1d4ec21-1c62-49ef-b296-9f295136751c + m_ActionName: Player/Weapon4[/Keyboard/4] + - m_PersistentCalls: + m_Calls: [] + m_ActionId: d1051e53-5f93-4997-a49c-b906e5986df3 + m_ActionName: Player/WeaponScroll[/Mouse/scroll] + m_NeverAutoSwitchControlSchemes: 0 + m_DefaultControlScheme: Keyboard + m_DefaultActionMap: Player + m_SplitScreenIndex: -1 + m_Camera: {fileID: 0} --- !u!1001 &7440994361082727519 PrefabInstance: m_ObjectHideFlags: 0 @@ -303,6 +423,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 27c63be2a8918c741863160b9d9da122, type: 3} m_Name: m_EditorClassIdentifier: + baseDamagePerShot: 20 damagePerShot: 20 timeBetweenBullets: 0.15 range: 100 diff --git a/Assets/Scenes/Level 01.unity b/Assets/Scenes/Level 01.unity index 307fa7d6cc15f1ed9b506e2eebe02c21e21c8a71..fbbea9ae58246b01bc680a7be0012b959ad04c76 100644 --- a/Assets/Scenes/Level 01.unity +++ b/Assets/Scenes/Level 01.unity @@ -248,12 +248,20 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4482145598804610889, guid: d794c4727125dfc44bfeef90cac9f5e3, type: 3} propertyPath: selectedWeapon - value: 4 + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5692892031156273332, guid: d794c4727125dfc44bfeef90cac9f5e3, type: 3} + propertyPath: m_IsActive + value: 0 objectReference: {fileID: 0} - target: {fileID: 5692892031156706452, guid: d794c4727125dfc44bfeef90cac9f5e3, type: 3} propertyPath: m_RootOrder value: 3 objectReference: {fileID: 0} + - target: {fileID: 7101622832953633692, guid: d794c4727125dfc44bfeef90cac9f5e3, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8707842788588381506, guid: d794c4727125dfc44bfeef90cac9f5e3, type: 3} propertyPath: m_RootOrder value: 2 diff --git a/Assets/Scripts/Managers/QuestManager.cs b/Assets/Scripts/Managers/QuestManager.cs index 4455c01b30f864c77e917808862beaaddece43b5..3fc3e099e5efbcb30b5f8d07b575628e5cd0672c 100644 --- a/Assets/Scripts/Managers/QuestManager.cs +++ b/Assets/Scripts/Managers/QuestManager.cs @@ -29,9 +29,15 @@ public class QuestManager : MonoBehaviour text.text = "Remaining Enemies : " + (maxEnemy - numEnemyDead); if (numEnemyDead == maxEnemy) { - textQuest.text = "Quest Selesai"; - text.color = new Color(1f, 1f, 1f, 0f); - levelCompleted.Raise(this, null); + QuestComplete(); } } + + [ContextMenu("End Game")] + public void QuestComplete() + { + textQuest.text = "Quest Selesai"; + text.color = new Color(1f, 1f, 1f, 0f); + levelCompleted.Raise(this, null); + } } diff --git a/Assets/Scripts/Shop/ShopItem.cs b/Assets/Scripts/Shop/ShopItem.cs index 73b84bb8d49f6242b51042a8d649b1964c2e3045..691fa3b677c34b7651d5075b0563351c6d55fe17 100644 --- a/Assets/Scripts/Shop/ShopItem.cs +++ b/Assets/Scripts/Shop/ShopItem.cs @@ -13,7 +13,11 @@ public class ShopItem : MonoBehaviour Weapon_Default, Weapon_Shotgun, Weapon_Bow, - Weapon_Sword + Weapon_Sword, + Weapon_Default_Upgrade, + Weapon_Sword_Upgrade, + Weapon_Shotgun_Upgrade, + Weapon_Bow_Upgrade, } public static int GetCost(ItemType itemType) @@ -29,6 +33,11 @@ public class ShopItem : MonoBehaviour case ItemType.Weapon_Bow: return 200; case ItemType.Weapon_Shotgun: return 100; case ItemType.Weapon_Sword: return 50; - } - } + + case ItemType.Weapon_Default_Upgrade: return 50; + case ItemType.Weapon_Bow_Upgrade: return 250; + case ItemType.Weapon_Shotgun_Upgrade: return 150; + case ItemType.Weapon_Sword_Upgrade: return 100; + } + } } diff --git a/Assets/Scripts/Shop/ShopUIController.cs b/Assets/Scripts/Shop/ShopUIController.cs index e932c5d894b9fec4ad1210cd278c89d81ff15301..a19b646134ef6c3f2894c341236b2905208ac0df 100644 --- a/Assets/Scripts/Shop/ShopUIController.cs +++ b/Assets/Scripts/Shop/ShopUIController.cs @@ -30,9 +30,14 @@ public class ShopUIController : MonoBehaviour CreateItemButton("Bow", ShopItem.ItemType.Weapon_Bow); CreateItemButton("Shotgun", ShopItem.ItemType.Weapon_Shotgun); CreateItemButton("Sword", ShopItem.ItemType.Weapon_Sword); - } - private void OnEnable() + CreateItemButton("Upgrade Gun", ShopItem.ItemType.Weapon_Default_Upgrade); + CreateItemButton("Upgrade Sword", ShopItem.ItemType.Weapon_Sword_Upgrade); + CreateItemButton("Upgrade Shotgun", ShopItem.ItemType.Weapon_Shotgun_Upgrade); + CreateItemButton("Upgrade Bow", ShopItem.ItemType.Weapon_Bow_Upgrade); + } + + private void OnEnable() { UpdateMoney(); @@ -50,12 +55,32 @@ public class ShopUIController : MonoBehaviour if(type == ShopItem.ItemType.Pet_Attack || type == ShopItem.ItemType.Pet_Buff || type == ShopItem.ItemType.Pet_Heal) { avail &= alreadyHasPet; - } + } + + // If type is not weapon upgrade, then this function will return true + avail &= checkIsWeaponUpgradeAvailable(type); shopItemController.UpdateAvailability(avail); shopItemTransform.gameObject.SetActive(true); } + private bool checkIsWeaponUpgradeAvailable(ShopItem.ItemType type) + { + switch (type) + { + case ShopItem.ItemType.Weapon_Default_Upgrade: + return true; + case ShopItem.ItemType.Weapon_Bow_Upgrade: + return true; + case ShopItem.ItemType.Weapon_Shotgun_Upgrade: + return true; + case ShopItem.ItemType.Weapon_Sword_Upgrade: + return true; + default: + return true; + } + } + private void UpdateMoney() { money = MoneyManager.money; diff --git a/Assets/WeaponController.cs b/Assets/WeaponController.cs index d4a74930a188f072abe5abb07beabfc342f83d87..2df566c18247918da13e64635124713356bc707b 100644 --- a/Assets/WeaponController.cs +++ b/Assets/WeaponController.cs @@ -1,9 +1,16 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.InputSystem; public class WeaponController : MonoBehaviour { + private bool weapon1Chosen = false; + private bool weapon2Chosen = false; + private bool weapon3Chosen = false; + private bool weapon4Chosen = false; + public float changeWeaponCooldown = 0.1f; + private bool canChangeWeapon = true; public int selectedWeapon = 0; // Start is called before the first frame update void Start() @@ -11,7 +18,7 @@ public class WeaponController : MonoBehaviour SelectWeapon(); } - // Update is called once per frame + /* void Update() { int previousWeapon= selectedWeapon; @@ -67,9 +74,28 @@ public class WeaponController : MonoBehaviour SelectWeapon(); } + }*/ + + private void Update() + { + if((weapon1Chosen || weapon2Chosen || weapon3Chosen || weapon4Chosen) && canChangeWeapon) + { + SelectWeapon(); + canChangeWeapon = false; + StartCoroutine(StartCooldown(changeWeaponCooldown, () => { canChangeWeapon = true; })); + Debug.Log("yo"); + } + } + + private IEnumerator StartCooldown(float cooldown, System.Action operation) + { + yield return new WaitForSeconds(cooldown); + operation(); } + void SelectWeapon() { + /* int i= 0; foreach (Transform weapon in transform) { @@ -82,6 +108,52 @@ public class WeaponController : MonoBehaviour weapon.gameObject.SetActive(false); } i++; + }*/ + foreach (Transform child in transform) + { + child.gameObject.SetActive(false); + } + + switch (selectedWeapon) + { + case 0: + transform.Find("DefaultWeapon").gameObject.SetActive(true); + transform.Find("DefaultWeaponEffect").gameObject.SetActive(true); + break; + case 1: + transform.Find("Magic_Sword").gameObject.SetActive(true); + break; + case 2: + transform.Find("Shotgun").gameObject.SetActive(true); + break; + case 3: + transform.Find("Arrow_and_Bow").gameObject.SetActive(true); + break; + default: + break; } } + public void onWeapon1Chosen(InputAction.CallbackContext context) + { + weapon1Chosen = context.action.triggered; + selectedWeapon = 0; + } + + public void onWeapon2Chosen(InputAction.CallbackContext context) + { + weapon2Chosen = context.action.triggered; + selectedWeapon = 1; + } + + public void onWeapon3Chosen(InputAction.CallbackContext context) + { + weapon3Chosen = context.action.triggered; + selectedWeapon = 2; + } + + public void onWeapon4Chosen(InputAction.CallbackContext context) + { + weapon4Chosen = context.action.triggered; + selectedWeapon = 3; + } } diff --git a/README.md b/README.md index becd7f734da5c86e961aa0f71a03a6d0a953c5d5..f47e57861ce2c956e7e401ab761d38216f72485c 100644 --- a/README.md +++ b/README.md @@ -21,20 +21,20 @@ Berikut ini adalah beberapa tangkapan layar dari game yang telah dibuat: Berikut ini adalah pembagian tugas dari tiap-tiap anggota kelompok: -| No | NIM | Nama | Pembagian Tugas | -| --- | -------- | -------------------------- | --------------- | -| 1 | 13520018 | Bariza Haqi | | -| 2 | 13520126 | Ignasius Ferry Priguna | | -| 3 | 13520128 | Bayu Samudra | | -| 4 | 13520145 | Steven Gianmarg H. Siahaan | | -| 5 | 13520152 | Muhammad Fahmi Irfan | | +| No | NIM | Nama | Pembagian Tugas | +| --- | -------- | -------------------------- | ----------------------------- | +| 1 | 13520018 | Bariza Haqi | | +| 2 | 13520126 | Ignasius Ferry Priguna | Main Menu, Pet | +| 3 | 13520128 | Bayu Samudra | | +| 4 | 13520145 | Steven Gianmarg H. Siahaan | | +| 5 | 13520152 | Muhammad Fahmi Irfan | | Berikut ini adalah jumlah jam persiapan dan pengerjaan masing-masing anggota: | No | NIM | Nama | Jam Persiapan | Jam Pengerjaan | | --- | -------- | -------------------------- | ------------- | -------------- | | 1 | 13520018 | Bariza Haqi | | | -| 2 | 13520126 | Ignasius Ferry Priguna | | | +| 2 | 13520126 | Ignasius Ferry Priguna | 6 | 24 | | 3 | 13520128 | Bayu Samudra | | | | 4 | 13520145 | Steven Gianmarg H. Siahaan | | | | 5 | 13520152 | Muhammad Fahmi Irfan | | |