diff options
33 files changed, 1082 insertions, 618 deletions
diff --git a/Assets/Animations/Prototype/Land.anim b/Assets/Animations/Prototype/Land.anim index a351ebe..f6a957a 100644 --- a/Assets/Animations/Prototype/Land.anim +++ b/Assets/Animations/Prototype/Land.anim @@ -54,7 +54,7 @@ AnimationClip: m_Level: 0 m_CycleOffset: 0 m_HasAdditiveReferencePose: 0 - m_LoopTime: 1 + m_LoopTime: 0 m_LoopBlend: 0 m_LoopBlendOrientation: 0 m_LoopBlendPositionY: 0 diff --git a/Assets/Animations/Prototype/Player.controller b/Assets/Animations/Prototype/Player.controller index 7ab32e2..8f5c56a 100644 --- a/Assets/Animations/Prototype/Player.controller +++ b/Assets/Animations/Prototype/Player.controller @@ -1,27 +1,5 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1101 &-9086515956729898478 -AnimatorStateTransition: - m_ObjectHideFlags: 1 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: - m_Conditions: [] - m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: 6109551287401904689} - m_Solo: 0 - m_Mute: 0 - m_IsExit: 0 - serializedVersion: 3 - m_TransitionDuration: 0 - m_TransitionOffset: 0.002329318 - m_ExitTime: 1 - m_HasExitTime: 1 - m_HasFixedDuration: 1 - m_InterruptionSource: 0 - m_OrderedInterruption: 1 - m_CanTransitionToSelf: 1 --- !u!1101 &-8626510112679481558 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -52,8 +30,8 @@ AnimatorStateTransition: m_PrefabAsset: {fileID: 0} m_Name: m_Conditions: - - m_ConditionMode: 1 - m_ConditionEvent: Stop + - m_ConditionMode: 2 + m_ConditionEvent: moving m_EventTreshold: 0 m_DstStateMachine: {fileID: 0} m_DstState: {fileID: 3614093525302314329} @@ -69,16 +47,19 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 ---- !u!1101 &-8037084840048493620 +--- !u!1101 &-6878608224570280004 AnimatorStateTransition: m_ObjectHideFlags: 1 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: - m_Conditions: [] + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: fall + m_EventTreshold: 0 m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: 9132405649074356357} + m_DstState: {fileID: 4014801967865307794} m_Solo: 0 m_Mute: 0 m_IsExit: 0 @@ -86,12 +67,12 @@ AnimatorStateTransition: m_TransitionDuration: 0 m_TransitionOffset: 0 m_ExitTime: 1 - m_HasExitTime: 1 + m_HasExitTime: 0 m_HasFixedDuration: 0 m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 ---- !u!1101 &-6878608224570280004 +--- !u!1101 &-6106642904432627373 AnimatorStateTransition: m_ObjectHideFlags: 1 m_CorrespondingSourceObject: {fileID: 0} @@ -100,51 +81,23 @@ AnimatorStateTransition: m_Name: m_Conditions: - m_ConditionMode: 1 - m_ConditionEvent: isAirborn + m_ConditionEvent: moving m_EventTreshold: 0 m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: 4014801967865307794} + m_DstState: {fileID: 6109551287401904689} m_Solo: 0 m_Mute: 0 m_IsExit: 0 serializedVersion: 3 m_TransitionDuration: 0 m_TransitionOffset: 0 - m_ExitTime: 1 + m_ExitTime: 0 m_HasExitTime: 0 - m_HasFixedDuration: 0 + m_HasFixedDuration: 1 m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 ---- !u!1107 &-6872323855171964326 -AnimatorStateMachine: - serializedVersion: 6 - m_ObjectHideFlags: 1 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Running - m_ChildStates: - - serializedVersion: 1 - m_State: {fileID: -1407507127539071288} - m_Position: {x: 460, y: -50, z: 0} - - serializedVersion: 1 - m_State: {fileID: 6109551287401904689} - m_Position: {x: 460, y: 50, z: 0} - - serializedVersion: 1 - m_State: {fileID: 3614093525302314329} - m_Position: {x: 460, y: 160, z: 0} - m_ChildStateMachines: [] - m_AnyStateTransitions: [] - m_EntryTransitions: [] - m_StateMachineTransitions: {} - m_StateMachineBehaviours: [] - m_AnyStatePosition: {x: 120, y: -250, z: 0} - m_EntryPosition: {x: 480, y: -150, z: 0} - m_ExitPosition: {x: 120, y: -210, z: 0} - m_ParentStateMachinePosition: {x: 460, y: 270, z: 0} - m_DefaultState: {fileID: -1407507127539071288} ---- !u!1101 &-6298420612714592867 +--- !u!1101 &-4025803860441014948 AnimatorStateTransition: m_ObjectHideFlags: 1 m_CorrespondingSourceObject: {fileID: 0} @@ -152,20 +105,20 @@ AnimatorStateTransition: m_PrefabAsset: {fileID: 0} m_Name: m_Conditions: - - m_ConditionMode: 2 - m_ConditionEvent: isAirborn + - m_ConditionMode: 1 + m_ConditionEvent: jump m_EventTreshold: 0 m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: 4014801967865307794} - m_Solo: 1 + m_DstState: {fileID: -3360105894821777026} + m_Solo: 0 m_Mute: 0 m_IsExit: 0 serializedVersion: 3 m_TransitionDuration: 0 m_TransitionOffset: 0 m_ExitTime: 0 - m_HasExitTime: 1 - m_HasFixedDuration: 0 + m_HasExitTime: 0 + m_HasFixedDuration: 1 m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 @@ -208,7 +161,7 @@ AnimatorState: m_CycleOffset: 0 m_Transitions: - {fileID: 2651979714303655906} - - {fileID: -8037084840048493620} + - {fileID: -1449902651349316248} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -224,6 +177,53 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: +--- !u!1101 &-1631153991909036912 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 9132405649074356357} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &-1449902651349316248 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 2 + m_ConditionEvent: airborn + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 0} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 1 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1102 &-1407507127539071288 AnimatorState: serializedVersion: 6 @@ -262,31 +262,36 @@ AnimatorStateMachine: m_ChildStates: - serializedVersion: 1 m_State: {fileID: 9132405649074356357} - m_Position: {x: 310, y: 110, z: 0} + m_Position: {x: 250, y: -10, z: 0} - serializedVersion: 1 m_State: {fileID: -3360105894821777026} - m_Position: {x: 450, y: 240, z: 0} + m_Position: {x: 450, y: 210, z: 0} - serializedVersion: 1 m_State: {fileID: 4014801967865307794} - m_Position: {x: 310, y: 350, z: 0} + m_Position: {x: 300, y: 320, z: 0} - serializedVersion: 1 m_State: {fileID: -3109416563068774462} - m_Position: {x: 170, y: 240, z: 0} - m_ChildStateMachines: + m_Position: {x: 200, y: 210, z: 0} + - serializedVersion: 1 + m_State: {fileID: -1407507127539071288} + m_Position: {x: 510, y: 50, z: 0} - serializedVersion: 1 - m_StateMachine: {fileID: -6872323855171964326} - m_Position: {x: 580, y: 110, z: 0} + m_State: {fileID: 3614093525302314329} + m_Position: {x: 510, y: -70, z: 0} + - serializedVersion: 1 + m_State: {fileID: 6109551287401904689} + m_Position: {x: 750, y: -10, z: 0} + m_ChildStateMachines: [] m_AnyStateTransitions: - {fileID: -6878608224570280004} - m_EntryTransitions: [] - m_StateMachineTransitions: - - first: {fileID: -6872323855171964326} - second: - - {fileID: 1807663489023768798} + - {fileID: -4025803860441014948} + m_EntryTransitions: + - {fileID: 9028498521707221212} + m_StateMachineTransitions: {} m_StateMachineBehaviours: [] - m_AnyStatePosition: {x: 50, y: 360, z: 0} - m_EntryPosition: {x: 50, y: 120, z: 0} - m_ExitPosition: {x: 830, y: 50, z: 0} + m_AnyStatePosition: {x: 610, y: 320, z: 0} + m_EntryPosition: {x: 270, y: 110, z: 0} + m_ExitPosition: {x: 60, y: 70, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} m_DefaultState: {fileID: 9132405649074356357} --- !u!91 &9100000 @@ -298,42 +303,30 @@ AnimatorController: m_Name: Player serializedVersion: 5 m_AnimatorParameters: - - m_Name: isRunning + - m_Name: moving m_Type: 4 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 0} - - m_Name: isAirborn - m_Type: 4 - m_DefaultFloat: 0 - m_DefaultInt: 0 - m_DefaultBool: 0 - m_Controller: {fileID: 0} - - m_Name: Jump - m_Type: 9 - m_DefaultFloat: 0 - m_DefaultInt: 0 - m_DefaultBool: 0 - m_Controller: {fileID: 0} - - m_Name: Land + m_Controller: {fileID: 9100000} + - m_Name: jump m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 0} - - m_Name: Run + m_Controller: {fileID: 9100000} + - m_Name: fall m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 0} - - m_Name: Stop - m_Type: 9 + m_Controller: {fileID: 9100000} + - m_Name: airborn + m_Type: 4 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 0} + m_Controller: {fileID: 9100000} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -356,7 +349,7 @@ AnimatorTransition: m_Name: m_Conditions: - m_ConditionMode: 1 - m_ConditionEvent: Jump + m_ConditionEvent: jump m_EventTreshold: 0 m_DstStateMachine: {fileID: 0} m_DstState: {fileID: -3360105894821777026} @@ -372,8 +365,8 @@ AnimatorStateTransition: m_PrefabAsset: {fileID: 0} m_Name: m_Conditions: - - m_ConditionMode: 1 - m_ConditionEvent: Land + - m_ConditionMode: 2 + m_ConditionEvent: airborn m_EventTreshold: 0 m_DstStateMachine: {fileID: 0} m_DstState: {fileID: -3109416563068774462} @@ -411,56 +404,6 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 ---- !u!1101 &3059356124330920494 -AnimatorStateTransition: - m_ObjectHideFlags: 1 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: - m_Conditions: - - m_ConditionMode: 1 - m_ConditionEvent: Jump - m_EventTreshold: 0 - m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: -3360105894821777026} - m_Solo: 0 - m_Mute: 0 - m_IsExit: 0 - serializedVersion: 3 - m_TransitionDuration: 0 - m_TransitionOffset: 0 - m_ExitTime: 1 - m_HasExitTime: 1 - m_HasFixedDuration: 1 - m_InterruptionSource: 0 - m_OrderedInterruption: 1 - m_CanTransitionToSelf: 1 ---- !u!1101 &3124419127409144405 -AnimatorStateTransition: - m_ObjectHideFlags: 1 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: - m_Conditions: - - m_ConditionMode: 1 - m_ConditionEvent: Run - m_EventTreshold: 0 - m_DstStateMachine: {fileID: -6872323855171964326} - m_DstState: {fileID: 0} - m_Solo: 0 - m_Mute: 0 - m_IsExit: 0 - serializedVersion: 3 - m_TransitionDuration: 0 - m_TransitionOffset: 0 - m_ExitTime: 1 - m_HasExitTime: 1 - m_HasFixedDuration: 1 - m_InterruptionSource: 0 - m_OrderedInterruption: 1 - m_CanTransitionToSelf: 1 --- !u!1102 &3614093525302314329 AnimatorState: serializedVersion: 6 @@ -473,6 +416,8 @@ AnimatorState: m_CycleOffset: 0 m_Transitions: - {fileID: 6564945159879590472} + - {fileID: -6106642904432627373} + - {fileID: -1631153991909036912} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -488,6 +433,20 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: +--- !u!1109 &3809652522530214263 +AnimatorTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 9132405649074356357} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 1 --- !u!1102 &4014801967865307794 AnimatorState: serializedVersion: 6 @@ -500,7 +459,6 @@ AnimatorState: m_CycleOffset: 0 m_Transitions: - {fileID: 2585772133770462678} - - {fileID: -6298420612714592867} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -528,7 +486,6 @@ AnimatorState: m_CycleOffset: 0 m_Transitions: - {fileID: -8388212156864459442} - - {fileID: -9086515956729898478} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -588,6 +545,48 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1101 &8602053559700435507 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: moving + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -1407507127539071288} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1109 &9028498521707221212 +AnimatorTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: moving + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -1407507127539071288} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 1 --- !u!1102 &9132405649074356357 AnimatorState: serializedVersion: 6 @@ -599,8 +598,7 @@ AnimatorState: m_Speed: 1 m_CycleOffset: 0 m_Transitions: - - {fileID: 3124419127409144405} - - {fileID: 3059356124330920494} + - {fileID: 8602053559700435507} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 diff --git a/Assets/InputActions.inputactions b/Assets/InputActions.inputactions new file mode 100644 index 0000000..5529905 --- /dev/null +++ b/Assets/InputActions.inputactions @@ -0,0 +1,140 @@ +{ + "name": "InputActions", + "maps": [ + { + "name": "Player", + "id": "7dd80b7d-e497-422c-aa32-0a94c0897478", + "actions": [ + { + "name": "Jump", + "type": "Button", + "id": "fdbb9049-81b8-4ae0-88bb-c7b5ed96a17c", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Move", + "type": "Value", + "id": "3e180de8-7f8c-4019-be7f-d7a7dd9700d2", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "Use", + "type": "Button", + "id": "18319b32-d662-4d4f-adec-97eab089357c", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + } + ], + "bindings": [ + { + "name": "", + "id": "165f0700-ae10-4680-b79a-596831d2ae9b", + "path": "<Keyboard>/space", + "interactions": "", + "processors": "", + "groups": "", + "action": "Jump", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "4fc63e21-3514-4132-a431-a396612de215", + "path": "<Gamepad>/leftStick", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "WASD", + "id": "99af77c2-3191-4722-96e8-26686b56f33e", + "path": "2DVector", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "up", + "id": "5977346b-5b7e-49c8-bd9c-5d9a22f7a78c", + "path": "<Keyboard>/w", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "792b46bf-716d-41f3-b0f6-407c64d0b156", + "path": "<Keyboard>/s", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "e5d852b7-9aab-47fa-92ac-0db64d257319", + "path": "<Keyboard>/a", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "943616d6-bbb8-4725-8396-58636ce9a418", + "path": "<Keyboard>/d", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "", + "id": "bd5cf375-f087-48b7-9fdf-f5600fb3afb2", + "path": "<Mouse>/leftButton", + "interactions": "", + "processors": "", + "groups": "", + "action": "Use", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "80aa2ba5-011e-48a0-af33-61fdbb45ca17", + "path": "<Keyboard>/f", + "interactions": "", + "processors": "", + "groups": "", + "action": "Use", + "isComposite": false, + "isPartOfComposite": false + } + ] + } + ], + "controlSchemes": [] +}
\ No newline at end of file diff --git a/Assets/InputActions.inputactions.meta b/Assets/InputActions.inputactions.meta new file mode 100644 index 0000000..44efcbb --- /dev/null +++ b/Assets/InputActions.inputactions.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 5d83e88135ebeec45bc94956b8c81029 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3} + generateWrapperCode: 0 + wrapperCodePath: + wrapperClassName: + wrapperCodeNamespace: diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index 9314392..3f95340 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -1,6 +1,6 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1 &5555712667017248113 +--- !u!1 &8816699565577033903 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -8,44 +8,77 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 5555712667017248116} - - component: {fileID: 5555712667017248117} - - component: {fileID: 5555712667017248115} - - component: {fileID: 5555712667017248077} - - component: {fileID: 5555712667017248078} - - component: {fileID: 5555712667017248079} - - component: {fileID: 5555712667017248076} - - component: {fileID: -784960068083288243} + - component: {fileID: 8816699565577033902} + m_Layer: 0 + m_Name: firePoint + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8816699565577033902 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8816699565577033903} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.41, y: -0.53, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8816699566000917964} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &8816699566000917961 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8816699566000917964} + - component: {fileID: 8816699566000917965} + - component: {fileID: 8816699566000918005} + - component: {fileID: 8816699566000918009} + - component: {fileID: 8816699566000918010} + - component: {fileID: 8816699566000918011} + - component: {fileID: 8816699566000918008} + - component: {fileID: 8816699566000918013} + - component: {fileID: 8816699566000918012} m_Layer: 0 m_Name: Player - m_TagString: Player + m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &5555712667017248116 +--- !u!4 &8816699566000917964 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5555712667017248113} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_GameObject: {fileID: 8816699566000917961} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 2, y: 2, z: 1} + m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 5287006658529300165} + - {fileID: 8816699566449425966} + - {fileID: 8816699565577033902} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &5555712667017248117 +--- !u!212 &8816699566000917965 SpriteRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5555712667017248113} + m_GameObject: {fileID: 8816699566000917961} m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 @@ -80,7 +113,7 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 - m_Sprite: {fileID: 1409862686, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + m_Sprite: {fileID: 2055064200, guid: 72a632f763991754fb9722d38264d272, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 @@ -91,52 +124,14 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!1839735485 &5555712667017248115 -Tilemap: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5555712667017248113} - m_Enabled: 1 - m_Tiles: {} - m_AnimatedTiles: {} - m_TileAssetArray: [] - m_TileSpriteArray: [] - m_TileMatrixArray: [] - m_TileColorArray: [] - m_TileObjectToInstantiateArray: [] - m_AnimationFrameRate: 1 - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_Origin: {x: 0, y: 0, z: 0} - m_Size: {x: 0, y: 0, z: 1} - m_TileAnchor: {x: 0.5, y: 0.5, z: 0} - m_TileOrientation: 0 - m_TileOrientationMatrix: - e00: 1 - e01: 0 - e02: 0 - e03: 0 - e10: 0 - e11: 1 - e12: 0 - e13: 0 - e20: 0 - e21: 0 - e22: 1 - e23: 0 - e30: 0 - e31: 0 - e32: 0 - e33: 1 ---- !u!95 &5555712667017248077 +--- !u!95 &8816699566000918005 Animator: serializedVersion: 4 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5555712667017248113} + m_GameObject: {fileID: 8816699566000917961} m_Enabled: 1 m_Avatar: {fileID: 0} m_Controller: {fileID: 9100000, guid: 363aef300fba71f40ab5aa64ba12659f, type: 2} @@ -149,14 +144,44 @@ Animator: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorControllerStateOnDisable: 0 ---- !u!50 &5555712667017248078 +--- !u!114 &8816699566000918009 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8816699566000917961} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Actions: {fileID: -944628639613478452, guid: 5d83e88135ebeec45bc94956b8c81029, type: 3} + m_NotificationBehavior: 3 + 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!50 &8816699566000918010 Rigidbody2D: serializedVersion: 4 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5555712667017248113} + m_GameObject: {fileID: 8816699566000917961} m_BodyType: 0 m_Simulated: 1 m_UseFullKinematicContacts: 0 @@ -166,17 +191,17 @@ Rigidbody2D: m_AngularDrag: 0.05 m_GravityScale: 1 m_Material: {fileID: 0} - m_Interpolate: 1 + m_Interpolate: 0 m_SleepingMode: 1 m_CollisionDetection: 0 m_Constraints: 0 ---- !u!70 &5555712667017248079 +--- !u!70 &8816699566000918011 CapsuleCollider2D: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5555712667017248113} + m_GameObject: {fileID: 8816699566000917961} m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} @@ -186,40 +211,35 @@ CapsuleCollider2D: m_Offset: {x: 0, y: 0} m_Size: {x: 1.2666667, y: 3} m_Direction: 0 ---- !u!114 &5555712667017248076 +--- !u!114 &8816699566000918008 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5555712667017248113} + m_GameObject: {fileID: 8816699566000917961} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: eb4a7477527c77541b25fea159d6b4c8, type: 3} + m_Script: {fileID: 11500000, guid: 8b7bd99a5fb2fc04eaa10dd4dca56706, type: 3} m_Name: m_EditorClassIdentifier: - mainCamera: {fileID: 0} - acceleration: 25 - smoothing: 0.05 gravityScale: 1.5 - jumpForce: 20 - maxJumpCount: 1 - airControl: 1 - direction: 1 - velocity: {x: 0, y: 0} - jumpCount: 0 - isGrounded: 0 - cameraPos: {x: 0, y: 0, z: 0} - _rigidBody: {fileID: 0} - _collider: {fileID: 0} - _transform: {fileID: 0} ---- !u!114 &-784960068083288243 + baseStats: + lives: 3 + speedMultiplier: 1 + maxJumps: 1 + jumpForce: 500 + groundLayer: + serializedVersion: 2 + m_Bits: 64 + groundCheckPoint: {fileID: 8816699566449425966} +--- !u!114 &8816699566000918013 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5555712667017248113} + m_GameObject: {fileID: 8816699566000917961} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 4ddff3a67736d7a42a22a7590fc5b028, type: 3} @@ -227,7 +247,21 @@ MonoBehaviour: m_EditorClassIdentifier: hook: {fileID: 5459487145348792490, guid: c5636787c9fa65743baae65d7537d65c, type: 3} ropeExists: 0 ---- !u!1 &8497962360219656301 +--- !u!114 &8816699566000918012 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8816699566000917961} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ad3b04484b235f743869b735c96d16b4, type: 3} + m_Name: + m_EditorClassIdentifier: + speed: 60 + rb: {fileID: 8816699566000918010} +--- !u!1 &8816699566449425967 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -235,26 +269,26 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 5287006658529300165} + - component: {fileID: 8816699566449425966} m_Layer: 0 - m_Name: firePoint + m_Name: GroundPoint m_TagString: Untagged - m_Icon: {fileID: 0} + m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &5287006658529300165 +--- !u!4 &8816699566449425966 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8497962360219656301} + m_GameObject: {fileID: 8816699566449425967} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.41, y: -0.53, z: 0} + m_LocalPosition: {x: 0, y: -1.5, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 5555712667017248116} + m_Father: {fileID: 8816699566000917964} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scenes/Jungle.unity b/Assets/Scenes/Jungle.unity index bfc0e65..2c10af5 100644 --- a/Assets/Scenes/Jungle.unity +++ b/Assets/Scenes/Jungle.unity @@ -1466,6 +1466,249 @@ Tilemap: e31: 0 e32: 0 e33: 1 +--- !u!1 &1517811032 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1517811037} + - component: {fileID: 1517811036} + - component: {fileID: 1517811034} + - component: {fileID: 1517811044} + - component: {fileID: 1517811048} + - component: {fileID: 1517811051} + - component: {fileID: 1517811050} + - component: {fileID: 1517811049} + m_Layer: 0 + m_Name: Player + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1839735485 &1517811034 +Tilemap: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1517811032} + m_Enabled: 1 + m_Tiles: {} + m_AnimatedTiles: {} + m_TileAssetArray: [] + m_TileSpriteArray: [] + m_TileMatrixArray: [] + m_TileColorArray: [] + m_TileObjectToInstantiateArray: [] + m_AnimationFrameRate: 1 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Origin: {x: 0, y: 0, z: 0} + m_Size: {x: 0, y: 0, z: 1} + m_TileAnchor: {x: 0.5, y: 0.5, z: 0} + m_TileOrientation: 0 + m_TileOrientationMatrix: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 +--- !u!212 &1517811036 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1517811032} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 2055064200, guid: 72a632f763991754fb9722d38264d272, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1.0625, y: 2.625} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &1517811037 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1517811032} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 2, y: 2, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1965704895} + m_Father: {fileID: 1936094548} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1517811044 +Animator: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1517811032} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 363aef300fba71f40ab5aa64ba12659f, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &1517811048 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1517811032} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Actions: {fileID: -944628639613478452, guid: 5d83e88135ebeec45bc94956b8c81029, type: 3} + m_NotificationBehavior: 3 + 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: 519420031} +--- !u!114 &1517811049 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1517811032} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b7bd99a5fb2fc04eaa10dd4dca56706, type: 3} + m_Name: + m_EditorClassIdentifier: + gravityScale: 1.5 + baseStats: + lives: 3 + speedMultiplier: 1 + maxJumps: 1 + jumpForce: 500 + groundLayer: + serializedVersion: 2 + m_Bits: 64 + groundCheckPoint: {fileID: 1965704895} + _collider: {fileID: 0} + _rigidBody: {fileID: 0} + _renderer: {fileID: 0} + _animator: {fileID: 0} + _transform: {fileID: 0} +--- !u!70 &1517811050 +CapsuleCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1517811032} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_Size: {x: 1.2666667, y: 3} + m_Direction: 0 +--- !u!50 &1517811051 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1517811032} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 --- !u!1 &1586752247 GameObject: m_ObjectHideFlags: 0 @@ -1562,7 +1805,7 @@ GameObject: - component: {fileID: 1742717048} - component: {fileID: 1742717047} - component: {fileID: 1742717046} - m_Layer: 0 + m_Layer: 6 m_Name: Collidable m_TagString: Untagged m_Icon: {fileID: 0} @@ -14026,6 +14269,37 @@ SpriteRenderer: m_WasSpriteAssigned: 0 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &1965704894 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1965704895} + m_Layer: 0 + m_Name: GroundPoint + m_TagString: Untagged + m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1965704895 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1965704894} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -1.5, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1517811037} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1968357772 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Actors.meta b/Assets/Scripts/Actors.meta new file mode 100644 index 0000000..c81eab2 --- /dev/null +++ b/Assets/Scripts/Actors.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 264776decce80664288a883d44adbd1a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Actors/Actor.cs b/Assets/Scripts/Actors/Actor.cs new file mode 100644 index 0000000..52a67d3 --- /dev/null +++ b/Assets/Scripts/Actors/Actor.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using MontanaJohns.Core; +using MontanaJohns.Items; +using UnityEngine; + +namespace MontanaJohns.Actors +{ + [RequireComponent(typeof(Rigidbody2D))] + [RequireComponent(typeof(CapsuleCollider2D))] + public abstract class Actor : MonoBehaviour + { + [SerializeField] protected float gravityScale = 1.5f; + [SerializeField] protected Stats baseStats = Stats.DefaultBaseStats(); + [SerializeField] protected LayerMask groundLayer; + [SerializeField] protected Transform groundCheckPoint; + + protected CapsuleCollider2D _collider; + protected Rigidbody2D _rigidBody; + protected SpriteRenderer _renderer; + protected Animator _animator; + protected Transform _transform; + + protected Stats stats; + protected Active activeItem; + Collection<Item> items; + bool isFalling; + + protected int jumpCount; + protected Vector2 acceleration; + + protected virtual void Awake() + { + _collider = GetComponent<CapsuleCollider2D>(); + _rigidBody = GetComponent<Rigidbody2D>(); + _transform = GetComponent<Transform>(); + _renderer = GetComponent<SpriteRenderer>(); + _animator = GetComponent<Animator>(); + } + + protected virtual void Start() + { + _rigidBody.freezeRotation = true; + _rigidBody.collisionDetectionMode = CollisionDetectionMode2D.Continuous; + _rigidBody.gravityScale = gravityScale; + + items = new(); + stats = baseStats; + jumpCount = stats.maxJumps; + } + + protected virtual void FixedUpdate() + { + if (!_animator.GetBool("airborn") && !Physics2D.OverlapCircle(groundCheckPoint.position, 0.2f, groundLayer)) + { + _animator.SetTrigger("fall"); + StartCoroutine(Falling()); + } + } + + public virtual void Move(float input) + { + var target = new Vector2(input * stats.speedMultiplier * 10, _rigidBody.velocity.y); + _rigidBody.velocity = Vector2.SmoothDamp(_rigidBody.velocity, target, ref acceleration, .05f); + _animator.SetBool("moving", Mathf.Abs(_rigidBody.velocity.x) > 0.001); + + if (_rigidBody.velocity.x < -0.001) + _renderer.flipX = true; + else if (_rigidBody.velocity.x > 0.001) + _renderer.flipX = false; + } + + public virtual void Jump() + { + if (jumpCount++ <= stats.maxJumps) + { + Debug.Log($"Jumping! Force: {stats.jumpForce}"); + _rigidBody.AddForce(Vector2.up * stats.jumpForce); + _animator.SetTrigger("jump"); + _animator.SetBool("airborn", true); + StartCoroutine(Falling()); + } + } + + public virtual void Use() + { + Debug.Log("Using!"); + if (activeItem != null) + activeItem.Use(); + } + + public virtual void AddItem(Item item) + { + Debug.Log($"Adding item: {item}!"); + items.Add(item); + stats = baseStats + items.Select(i => i.stats).Sum(); + } + + IEnumerator Falling() + { + Debug.Log("Falling!"); + + _animator.SetBool("airborn", true); + + while (_rigidBody.velocity.y > 0 || !Physics2D.OverlapCircle(groundCheckPoint.position, 0.2f, groundLayer)) + { + yield return new WaitForFixedUpdate(); + } + + jumpCount = 0; + _animator.SetBool("airborn", false); + + Debug.Log("Fell!"); + + yield break; + } + } +}
\ No newline at end of file diff --git a/Assets/Scripts/RopePrototype.cs.meta b/Assets/Scripts/Actors/Actor.cs.meta index 4ce3825..e88cc1a 100644 --- a/Assets/Scripts/RopePrototype.cs.meta +++ b/Assets/Scripts/Actors/Actor.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f828efbe27e65524c9d7e0d87b6a6f0f +guid: 8e4e952a669f0f94786fa19bfff7095e MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Actors/Player.cs b/Assets/Scripts/Actors/Player.cs new file mode 100644 index 0000000..1edbbd7 --- /dev/null +++ b/Assets/Scripts/Actors/Player.cs @@ -0,0 +1,47 @@ +using MontanaJohns.Core.Interfaces; +using MontanaJohns.Items; +using UnityEngine; +using UnityEngine.InputSystem; + +namespace MontanaJohns.Actors +{ + [RequireComponent(typeof(Rigidbody2D))] + [RequireComponent(typeof(CapsuleCollider2D))] + public class Player : Actor, IFollowable + { + public Transform ActorTransform => _transform; + public Camera MainCamera => _camera; + + Camera _camera; + PlayerInput playerInput; + InputAction use, move, jump; + + protected override void Awake() + { + base.Awake(); + _camera = FindObjectOfType<Camera>(); + playerInput = GetComponent<PlayerInput>(); + move = playerInput.currentActionMap.FindAction("Move"); + jump = playerInput.currentActionMap.FindAction("Jump"); + use = playerInput.currentActionMap.FindAction("Use"); + + jump.started += context => Jump(); + + use.started += context => Use(); + move.started += context => Debug.Log("Moving!"); + move.performed += context => Debug.Log("Stopping!"); + } + + protected override void Start() + { + base.Start(); + activeItem = gameObject.AddComponent<Whip>(); + } + + protected void Update() + { + ((IFollowable)this).Follow(); + base.Move(move.ReadValue<Vector2>().x); + } + } +}
\ No newline at end of file diff --git a/Assets/Scripts/CharacterController2D.cs.meta b/Assets/Scripts/Actors/Player.cs.meta index 1f71f96..2b84a97 100644 --- a/Assets/Scripts/CharacterController2D.cs.meta +++ b/Assets/Scripts/Actors/Player.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: eb4a7477527c77541b25fea159d6b4c8 +guid: 8b7bd99a5fb2fc04eaa10dd4dca56706 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/CharacterController2D.cs b/Assets/Scripts/CharacterController2D.cs deleted file mode 100644 index bf62498..0000000 --- a/Assets/Scripts/CharacterController2D.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System; -using System.Collections; -using UnityEngine; -using UnityEngine.Events; - -[RequireComponent(typeof(Rigidbody2D))] -[RequireComponent(typeof(CapsuleCollider2D))] - -public class CharacterController2D : MonoBehaviour -{ - public enum Direction - { - left = -1, - right = 1 - } - - [SerializeField] Camera mainCamera; - [SerializeField] float acceleration = 40f; - [SerializeField][Range(0, .3f)] float smoothing = .05f; - [SerializeField] float gravityScale = 1.5f; - [SerializeField] float jumpForce = 50f; - [SerializeField] int maxJumpCount = 1; - [SerializeField] bool airControl = true; - - internal UnityEvent OnIdleEvent; - internal UnityEvent OnFlip; - internal UnityEvent OnJump; - internal UnityEvent OnLand; - internal UnityEvent OnFall; - - public Direction direction = Direction.right; - public Vector2 velocity = Vector2.zero; - public int jumpCount = 0; - public bool isGrounded = false; - public Vector3 cameraPos; - public Rigidbody2D _rigidBody; - public CapsuleCollider2D _collider; - public Transform _transform; - - void Awake() - { - _rigidBody = GetComponent<Rigidbody2D>(); - _collider = GetComponent<CapsuleCollider2D>(); - OnIdleEvent ??= new UnityEvent(); - OnFlip ??= new UnityEvent(); - OnJump ??= new UnityEvent(); - OnFall ??= new UnityEvent(); - OnLand ??= new UnityEvent(); - } - - // Use this for initialization - void Start() - { - _transform = transform; - _rigidBody.freezeRotation = true; - _rigidBody.collisionDetectionMode = CollisionDetectionMode2D.Continuous; - _rigidBody.gravityScale = gravityScale; - direction = (Direction)(_transform.localScale.x / Mathf.Abs(_transform.localScale.x)); - - jumpCount = maxJumpCount; - - if (mainCamera) - cameraPos = mainCamera.transform.position; - - OnFlip.AddListener(HandleFlip); - OnJump.AddListener(HandleJump); - OnFall.AddListener(HandleFall); - OnLand.AddListener(HandleLand); - } - - void Update() - { - if (isGrounded || airControl) - HandleHorzInput(Input.GetAxisRaw("Horizontal")); - - // Changing this to `canJump` or `jumpCount > 0` would allow for things like double jumping. - if (jumpCount > 0 && Input.GetButtonDown("Jump")) - OnJump.Invoke(); - - - if (mainCamera) - { - var targetPos = new Vector3(_transform.position.x, cameraPos.y, cameraPos.z); - mainCamera.transform.position = Vector3.Lerp(mainCamera.transform.position, targetPos, 0.25f); - } - } - - void FixedUpdate() - { - CheckCollision(); - } - - public void Move(float magnitude) - { - Vector3 targetVelocity = new Vector2(magnitude, _rigidBody.velocity.y); - _rigidBody.velocity = Vector2.SmoothDamp(_rigidBody.velocity, targetVelocity, ref velocity, smoothing); - } - - void CheckCollision() - { - var evnt = isGrounded ? OnFall : OnLand; - - float colliderRadius = _collider.size.x * 0.4f * Mathf.Abs(transform.localScale.x); - Vector3 groundCheckPos = new Vector3(_collider.bounds.size.x * 0.5f, colliderRadius * 0.9f, 0) + _collider.bounds.min; - Collider2D[] colliders = Physics2D.OverlapCircleAll(groundCheckPos, colliderRadius); - - if (Array.Exists(colliders, c => c != _collider)) - { - Debug.Log(Array.Find(colliders, c => c != _collider)); - evnt.Invoke(); - } - } - - void HandleHorzInput(float horzInput) - { - Move(horzInput * acceleration); - - if (horzInput * (int)direction < 0) - OnFlip.Invoke(); - } - - - void HandleFlip() - { - Debug.Log("Flipping"); - Vector3 theScale = transform.localScale; - theScale.x *= -1; - transform.localScale = theScale; - - direction = direction == Direction.left ? Direction.right : Direction.left; - } - - void HandleJump() - { - Debug.Log("Jumping"); - jumpCount--; - _rigidBody.AddForce(Vector2.up * jumpForce); - OnFall.Invoke(); - } - - - void HandleFall() - { - Debug.Log("Falling"); - isGrounded = false; - } - - void HandleLand() - { - Debug.Log("Landing"); - isGrounded = true; - jumpCount = maxJumpCount; - } -} diff --git a/Assets/Scripts/Core.meta b/Assets/Scripts/Core.meta new file mode 100644 index 0000000..bcf3b71 --- /dev/null +++ b/Assets/Scripts/Core.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e4d5f9e2063543943aa5e760aa77f10a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Core/Interfaces.meta b/Assets/Scripts/Core/Interfaces.meta new file mode 100644 index 0000000..050910c --- /dev/null +++ b/Assets/Scripts/Core/Interfaces.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bfa16d0e0353499459486776ae1559ea +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Core/Interfaces/IFollowable.cs b/Assets/Scripts/Core/Interfaces/IFollowable.cs new file mode 100644 index 0000000..92320de --- /dev/null +++ b/Assets/Scripts/Core/Interfaces/IFollowable.cs @@ -0,0 +1,18 @@ + +using UnityEngine; + +namespace MontanaJohns.Core.Interfaces +{ + public interface IFollowable + { + Transform ActorTransform { get; } + Camera MainCamera { get; } + + public void Follow() + { + Vector3 pos = MainCamera.transform.position; + pos.x = Mathf.Lerp(ActorTransform.position.x, MainCamera.transform.position.x, 0.25f); + MainCamera.transform.position = pos; + } + } +}
\ No newline at end of file diff --git a/Assets/Scripts/RopeThrowPrototype.cs.meta b/Assets/Scripts/Core/Interfaces/IFollowable.cs.meta index 3fccef5..4330668 100644 --- a/Assets/Scripts/RopeThrowPrototype.cs.meta +++ b/Assets/Scripts/Core/Interfaces/IFollowable.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4ddff3a67736d7a42a22a7590fc5b028 +guid: 51a83677c8f15834bb02f2ac447d6727 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Core/Stats.cs b/Assets/Scripts/Core/Stats.cs new file mode 100644 index 0000000..29afbe3 --- /dev/null +++ b/Assets/Scripts/Core/Stats.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace MontanaJohns.Core +{ + public static class StatsExtensions + { + public static Stats Sum(this IEnumerable<Stats> source) + { + var sum = default(Stats); + using (var iter = source.GetEnumerator()) + { + if (!iter.MoveNext()) return sum; + while (iter.MoveNext()) sum += iter.Current; + return sum; + } + } + } + + [System.Serializable] + public struct Stats + { + [SerializeField] public int lives; + [SerializeField] public float speedMultiplier; + [SerializeField] public int maxJumps; + [SerializeField] public float jumpForce; + + public static Stats operator +(Stats x, Stats y) + { + return new Stats + { + lives = x.lives + y.lives, + speedMultiplier = x.speedMultiplier + y.speedMultiplier, + maxJumps = x.maxJumps + y.maxJumps, + jumpForce = x.jumpForce + y.jumpForce + }; + } + + public static Stats DefaultBaseStats() + { + return new Stats + { + lives = 3, + speedMultiplier = 1, + maxJumps = 1, + jumpForce = 500f, + }; + } + } +}
\ No newline at end of file diff --git a/Assets/Scripts/FollowCamera.cs.meta b/Assets/Scripts/Core/Stats.cs.meta index cc6627c..3862953 100644 --- a/Assets/Scripts/FollowCamera.cs.meta +++ b/Assets/Scripts/Core/Stats.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f2db6b4344b743a428dae55cd1303cfb +guid: fc3f0c9b9011d6d4d974a49bf8a39201 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/FollowCamera.cs b/Assets/Scripts/FollowCamera.cs deleted file mode 100644 index 5b58766..0000000 --- a/Assets/Scripts/FollowCamera.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Collections; -using UnityEngine; - -public class FollowCamera : MonoBehaviour -{ - public float speed = 15f; - public float minDistance; - public GameObject target; - public Vector3 offset; - - private Vector3 targetPos; - - // Use this for initialization - void Start() - { - targetPos = transform.position; - } - - // Update is called once per frame - void Update() - { - if (target) - { - Vector3 posNoZ = transform.position + offset; - Vector3 targetDirection = (target.transform.position - posNoZ); - float interpVelocity = targetDirection.magnitude * speed; - targetPos = (transform.position) + (targetDirection.normalized * interpVelocity * Time.deltaTime); - - - } - } -}
\ No newline at end of file diff --git a/Assets/Scripts/InfiniteBackground.cs b/Assets/Scripts/InfiniteBackground.cs index d587040..5c28723 100644 --- a/Assets/Scripts/InfiniteBackground.cs +++ b/Assets/Scripts/InfiniteBackground.cs @@ -3,7 +3,7 @@ using UnityEngine; public class InfiniteBackground : MonoBehaviour { - [SerializeField] GameObject cam; + [SerializeField] Camera mainCamera; [SerializeField] float parallaxEffect = 0.3f; internal Vector2 pos; @@ -18,7 +18,7 @@ public class InfiniteBackground : MonoBehaviour void FixedUpdate() { float camExtentX = Camera.main.orthographicSize * Screen.width / Screen.height; - float newPosX = pos.x + (cam.transform.position.x * parallaxEffect); + float newPosX = pos.x + (mainCamera.transform.position.x * parallaxEffect); if (newPosX + spriteExtentX <= Camera.main.transform.position.x + camExtentX) { diff --git a/Assets/Scripts/Items.meta b/Assets/Scripts/Items.meta new file mode 100644 index 0000000..867c6e6 --- /dev/null +++ b/Assets/Scripts/Items.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 871314dd539777c4ebeb1d6d22f999cc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Items/Active.cs b/Assets/Scripts/Items/Active.cs new file mode 100644 index 0000000..5cec317 --- /dev/null +++ b/Assets/Scripts/Items/Active.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace MontanaJohns.Items +{ + public abstract class Active : Item + { + public abstract void Use(); + } +}
\ No newline at end of file diff --git a/Assets/Scripts/Items/Active.cs.meta b/Assets/Scripts/Items/Active.cs.meta new file mode 100644 index 0000000..9860ebb --- /dev/null +++ b/Assets/Scripts/Items/Active.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1df0dcff4f17ccf478e98121307daa6b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Items/Item.cs b/Assets/Scripts/Items/Item.cs new file mode 100644 index 0000000..4bf420d --- /dev/null +++ b/Assets/Scripts/Items/Item.cs @@ -0,0 +1,10 @@ +using MontanaJohns.Core; +using UnityEngine; + +namespace MontanaJohns.Items +{ + public abstract class Item : MonoBehaviour + { + public Stats stats; + } +}
\ No newline at end of file diff --git a/Assets/Scripts/Items/Item.cs.meta b/Assets/Scripts/Items/Item.cs.meta new file mode 100644 index 0000000..7666726 --- /dev/null +++ b/Assets/Scripts/Items/Item.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 19256fc4d714d7245a9a7308929eee07 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Items/Whip.cs b/Assets/Scripts/Items/Whip.cs new file mode 100644 index 0000000..1a675ce --- /dev/null +++ b/Assets/Scripts/Items/Whip.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace MontanaJohns.Items +{ + public class Whip : Active + { + public GameObject hook; + public bool ropeExists = false; + + GameObject currentHook; + + // Update is called once per frame + public override void Use() + { + if (!ropeExists) + { + // Vector2 clickLocation = Mouse.current.position; + + // currentHook = (GameObject)Instantiate(hook, clickLocation, Quaternion.identity); + ropeExists = true; + } + else + { + Destroy(currentHook); + ropeExists = false; + } + } + } +}
\ No newline at end of file diff --git a/Assets/Scripts/Items/Whip.cs.meta b/Assets/Scripts/Items/Whip.cs.meta new file mode 100644 index 0000000..34d7701 --- /dev/null +++ b/Assets/Scripts/Items/Whip.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 38e73d67ecfac5f44b3cb07408f64a56 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: + - hook: {fileID: 5459487145348792490, guid: c5636787c9fa65743baae65d7537d65c, type: 3} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/RopePrototype.cs b/Assets/Scripts/RopePrototype.cs deleted file mode 100644 index b2f37ab..0000000 --- a/Assets/Scripts/RopePrototype.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class RopePrototype : MonoBehaviour -{ - public int constraintIterations = 50; - public float gravityMultiplier = 1.0f; - public float lineWidth = 0.1f; - public float ropeSegmentLength = 0.25f; - public int segmentCount = 35; - - LineRenderer lr; - DistanceJoint2D dj; - GameObject player; - List<RopeSegment> ropeSegments = new List<RopeSegment>(); - Vector3[] ropePositions; - bool ropeCreated = false; - - // Start is called before the first frame update - void Start() - { - player = GameObject.FindGameObjectWithTag("Player"); - dj = GetComponent<DistanceJoint2D>(); - lr = GetComponent<LineRenderer>(); - lr.startWidth = lineWidth; - lr.endWidth = lineWidth; - ropePositions = new Vector3[segmentCount]; - lr.positionCount = segmentCount; - Vector2 ropeLoc = transform.position; - - for (int i = 0; i < segmentCount; i++) - { - ropeSegments.Add(new RopeSegment(ropeLoc)); - ropeLoc.y -= ropeSegmentLength; - } - } - - // Update is called once per frame - void Update() - { - if (!ropeCreated) - { - CreateRope(); - ropeCreated = true; - } - RenderLine(); - Simulate(); - } - - void RenderLine() - { - for(int i = 0; i < ropePositions.Length; i++) - { - ropePositions[i] = ropeSegments[i].posNow; - } - lr.SetPositions(ropePositions); - } - - void CreateRope() - { - dj.connectedBody = player.GetComponent<Rigidbody2D>(); - dj.maxDistanceOnly = true; - dj.distance = Vector2.Distance(player.transform.position, transform.position); - } - - void Simulate() - { - Vector2 gravityForce = new Vector2(0f, -gravityMultiplier); - - for(int i = 0; i < ropeSegments.Count; i++) - { - RopeSegment segment = ropeSegments[i]; - Vector2 velocity = segment.posNow - segment.posOld; - segment.posOld = segment.posNow; - segment.posNow += velocity; - segment.posNow += gravityForce * Time.deltaTime; - ropeSegments[i] = segment; - } - - for(int i = 0; i < constraintIterations; i++) - { - ApplyContraint(); - } - } - - void ApplyContraint() - { - RopeSegment endSegment1 = ropeSegments[0]; - endSegment1.posNow = transform.position; - ropeSegments[0] = endSegment1; - - RopeSegment endSegment2 = ropeSegments[ropeSegments.Count - 1]; - endSegment2.posNow = player.transform.position; - ropeSegments[ropeSegments.Count - 1] = endSegment2; - - for (int i = 0; i < ropeSegments.Count-1; i++) - { - RopeSegment segment1 = ropeSegments[i]; - RopeSegment segment2 = ropeSegments[i + 1]; - - float distance = (segment1.posNow - segment2.posNow).magnitude; - float error = distance - ropeSegmentLength; - Vector2 normalChange = (segment1.posNow - segment2.posNow).normalized; - Vector2 change = normalChange * error; - - if(i != 0) - { - segment1.posNow -= change * 0.5f; - ropeSegments[i] = segment1; - segment2.posNow += change * 0.5f; - ropeSegments[i + 1] = segment2; - } - else - { - segment2.posNow += change; - ropeSegments[i + 1] = segment2; - } - } - } - - public struct RopeSegment - { - public Vector2 posNow; - public Vector2 posOld; - - public RopeSegment(Vector2 pos) - { - this.posNow = pos; - this.posOld = pos; - } - } -} diff --git a/Assets/Scripts/RopeThrowPrototype.cs b/Assets/Scripts/RopeThrowPrototype.cs deleted file mode 100644 index d828cca..0000000 --- a/Assets/Scripts/RopeThrowPrototype.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class RopeThrowPrototype : MonoBehaviour -{ - public GameObject hook; - public bool ropeExists = false; - - GameObject currentHook; - - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - if (Input.GetMouseButtonDown(0)) - { - if (!ropeExists) - { - Vector2 clickLocation = Camera.main.ScreenToWorldPoint(Input.mousePosition); - - currentHook = (GameObject)Instantiate(hook, clickLocation, Quaternion.identity); - ropeExists = true; - } - else - { - Destroy(currentHook); - ropeExists = false; - } - } - } -} diff --git a/Packages/manifest.json b/Packages/manifest.json index 8a81b75..5f8bb7e 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -6,6 +6,7 @@ "com.unity.ide.rider": "3.0.12", "com.unity.ide.visualstudio": "2.0.14", "com.unity.ide.vscode": "1.2.5", + "com.unity.inputsystem": "1.3.0", "com.unity.test-framework": "1.1.31", "com.unity.textmeshpro": "3.0.6", "com.unity.timeline": "1.6.4", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 274ffb8..c473e89 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -53,6 +53,15 @@ "dependencies": {}, "url": "https://packages.unity.com" }, + "com.unity.inputsystem": { + "version": "1.3.0", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.uielements": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.services.core": { "version": "1.0.1", "depth": 1, diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 34a2ed9..2124b67 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -653,7 +653,7 @@ PlayerSettings: m_VersionCode: 1 m_VersionName: apiCompatibilityLevel: 6 - activeInputHandler: 0 + activeInputHandler: 1 cloudProjectId: framebufferDepthMemorylessMode: 0 qualitySettingsNames: [] diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 5927853..ab9b75b 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -11,7 +11,7 @@ TagManager: - - Water - UI - - + - Ground - - - |