From 0824f3c99a34e11ef7134a0dbff9998f420b651b Mon Sep 17 00:00:00 2001 From: RochesterX Date: Fri, 17 Jan 2025 12:57:43 -0500 Subject: [PATCH] Implement Punch --- Assets/Animations/Bones/Bones.controller | 171 +++++++- Assets/Animations/Bones/TrevorPunch.anim | 382 +++++++++--------- .../Input System/Player Actions.inputactions | 88 +++- Assets/Prefabs/Bones.prefab | 21 +- Assets/Punch.cs | 22 + Assets/Punch.cs.meta | 2 + Assets/Scripts/AnimationPlayer.cs | 5 + 7 files changed, 476 insertions(+), 215 deletions(-) create mode 100644 Assets/Punch.cs create mode 100644 Assets/Punch.cs.meta diff --git a/Assets/Animations/Bones/Bones.controller b/Assets/Animations/Bones/Bones.controller index 120d700..d8f971a 100644 --- a/Assets/Animations/Bones/Bones.controller +++ b/Assets/Animations/Bones/Bones.controller @@ -1,6 +1,6 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1101 &-7951230361386602773 +--- !u!1101 &-8088454279998633666 AnimatorStateTransition: m_ObjectHideFlags: 1 m_CorrespondingSourceObject: {fileID: 0} @@ -24,8 +24,8 @@ AnimatorStateTransition: m_HasFixedDuration: 1 m_InterruptionSource: 0 m_OrderedInterruption: 1 - m_CanTransitionToSelf: 0 ---- !u!1101 &-7336001256458513922 + m_CanTransitionToSelf: 1 +--- !u!1101 &-3289816270970516984 AnimatorStateTransition: m_ObjectHideFlags: 1 m_CorrespondingSourceObject: {fileID: 0} @@ -35,21 +35,46 @@ AnimatorStateTransition: m_Conditions: - m_ConditionMode: 6 m_ConditionEvent: state - m_EventTreshold: 2 + m_EventTreshold: 1 m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: -65348665591799820} + m_DstState: {fileID: 2600039493493020915} m_Solo: 0 m_Mute: 0 m_IsExit: 0 serializedVersion: 3 - m_TransitionDuration: 0.2 + m_TransitionDuration: 0.25 m_TransitionOffset: 0 m_ExitTime: 0.75 m_HasExitTime: 0 m_HasFixedDuration: 1 m_InterruptionSource: 0 m_OrderedInterruption: 1 - m_CanTransitionToSelf: 0 + m_CanTransitionToSelf: 1 +--- !u!1101 &-3226116647278939360 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 6 + m_ConditionEvent: state + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1699472617733096240} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.1 + m_TransitionOffset: 0 + m_ExitTime: 0.625 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1107 &-1538096663108953913 AnimatorStateMachine: serializedVersion: 6 @@ -61,7 +86,7 @@ AnimatorStateMachine: m_ChildStates: - serializedVersion: 1 m_State: {fileID: 2600039493493020915} - m_Position: {x: 290, y: 0, z: 0} + m_Position: {x: 550, y: 0, z: 0} - serializedVersion: 1 m_State: {fileID: -65348665591799820} m_Position: {x: 290, y: 50, z: 0} @@ -70,21 +95,19 @@ AnimatorStateMachine: m_Position: {x: 290, y: -50, z: 0} - serializedVersion: 1 m_State: {fileID: 4390441580030614539} - m_Position: {x: 325, y: 15, z: 0} + m_Position: {x: 60, y: 80, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: - - {fileID: -7951230361386602773} - - {fileID: -325823806790880945} - - {fileID: -7336001256458513922} + - {fileID: 5263795009836994554} m_EntryTransitions: [] m_StateMachineTransitions: {} m_StateMachineBehaviours: [] m_AnyStatePosition: {x: 80, y: 0, z: 0} - m_EntryPosition: {x: 540, y: 0, z: 0} + m_EntryPosition: {x: 890, y: 0, z: 0} m_ExitPosition: {x: 800, y: 120, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} m_DefaultState: {fileID: 2600039493493020915} ---- !u!1101 &-325823806790880945 +--- !u!1101 &-1491732674038617540 AnimatorStateTransition: m_ObjectHideFlags: 1 m_CorrespondingSourceObject: {fileID: 0} @@ -108,7 +131,32 @@ AnimatorStateTransition: m_HasFixedDuration: 1 m_InterruptionSource: 0 m_OrderedInterruption: 1 - m_CanTransitionToSelf: 0 + m_CanTransitionToSelf: 1 +--- !u!1101 &-1027424570895581804 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 6 + m_ConditionEvent: state + m_EventTreshold: 2 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -65348665591799820} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.2 + m_TransitionOffset: 0 + m_ExitTime: 0.625 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1102 &-65348665591799820 AnimatorState: serializedVersion: 6 @@ -119,7 +167,9 @@ AnimatorState: m_Name: Jump m_Speed: 1 m_CycleOffset: 0 - m_Transitions: [] + m_Transitions: + - {fileID: -1491732674038617540} + - {fileID: -3289816270970516984} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -150,6 +200,12 @@ AnimatorController: m_DefaultInt: 0 m_DefaultBool: 0 m_Controller: {fileID: 9100000} + - m_Name: punch + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 1 + m_Controller: {fileID: 9100000} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -163,6 +219,31 @@ AnimatorController: m_IKPass: 0 m_SyncedLayerAffectsTiming: 0 m_Controller: {fileID: 9100000} +--- !u!1101 &1187931533429329025 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 6 + m_ConditionEvent: state + m_EventTreshold: 2 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -65348665591799820} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.2 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1102 &1699472617733096240 AnimatorState: serializedVersion: 6 @@ -173,7 +254,9 @@ AnimatorState: m_Name: Idle m_Speed: 1 m_CycleOffset: 0 - m_Transitions: [] + m_Transitions: + - {fileID: -8088454279998633666} + - {fileID: 1187931533429329025} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -199,7 +282,9 @@ AnimatorState: m_Name: Walk m_Speed: 1 m_CycleOffset: 0 - m_Transitions: [] + m_Transitions: + - {fileID: -3226116647278939360} + - {fileID: -1027424570895581804} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -225,7 +310,8 @@ AnimatorState: m_Name: TrevorPunch m_Speed: 1 m_CycleOffset: 0 - m_Transitions: [] + m_Transitions: + - {fileID: 7801668757208663834} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -241,3 +327,50 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: +--- !u!1101 &5263795009836994554 +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: punch + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 4390441580030614539} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.05 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &7801668757208663834 +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: 1699472617733096240} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.1 + m_TransitionOffset: 0 + m_ExitTime: 0.7972973 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 diff --git a/Assets/Animations/Bones/TrevorPunch.anim b/Assets/Animations/Bones/TrevorPunch.anim index ccabeb7..763f062 100644 --- a/Assets/Animations/Bones/TrevorPunch.anim +++ b/Assets/Animations/Bones/TrevorPunch.anim @@ -27,7 +27,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: {x: 0, y: 0, z: 139.676} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -36,7 +36,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: {x: 0, y: 0, z: 271.124} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -45,7 +45,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.9166667 + time: 0.65 value: {x: 0, y: 0, z: 139.676} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -54,7 +54,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: {x: 0, y: 0, z: 180} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -79,7 +79,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: {x: 0, y: 0, z: 190.902} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -88,7 +88,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: {x: 0, y: 0, z: 177.707} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -97,7 +97,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: {x: 0, y: 0, z: 180} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -122,7 +122,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: {x: 0, y: 0, z: 175.441} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -131,16 +131,16 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: {x: 0, y: 0, z: 187.54} - inSlope: {x: 0, y: 0, z: 0.65460175} - outSlope: {x: 0, y: 0, z: 0.65460175} + inSlope: {x: 0, y: 0, z: 0.6546018} + outSlope: {x: 0, y: 0, z: 0.6546018} tangentMode: 0 weightedMode: 0 inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: {x: 0, y: 0, z: 187.66} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -165,7 +165,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: {x: 0, y: 0, z: 168.801} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -174,16 +174,16 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: {x: 0, y: 0, z: 180.9} - inSlope: {x: 0, y: 0, z: 0.66001236} - outSlope: {x: 0, y: 0, z: 0.66001236} + inSlope: {x: 0, y: 0, z: 0.6600124} + outSlope: {x: 0, y: 0, z: 0.6600124} tangentMode: 0 weightedMode: 0 inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: {x: 0, y: 0, z: 181.021} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -208,7 +208,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: {x: 0, y: 0, z: 111.883} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -217,7 +217,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: {x: 0, y: 0, z: 1.817} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -226,7 +226,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.9166667 + time: 0.65 value: {x: 0, y: 0, z: 111.883} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -251,7 +251,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: {x: 0, y: 0, z: 156.099} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -276,7 +276,7 @@ AnimationClip: inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: {x: 0, y: 0, z: 55.933} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} @@ -368,7 +368,7 @@ AnimationClip: m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 1.2333333 + m_StopTime: 0.96666664 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 @@ -398,7 +398,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 0 inSlope: 0 outSlope: 0 @@ -407,7 +407,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -416,7 +416,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.9166667 + time: 0.65 value: 0 inSlope: 0 outSlope: 0 @@ -425,7 +425,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: 0 inSlope: 0 outSlope: 0 @@ -455,7 +455,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 0 inSlope: 0 outSlope: 0 @@ -464,7 +464,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -473,7 +473,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.9166667 + time: 0.65 value: 0 inSlope: 0 outSlope: 0 @@ -482,7 +482,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: 0 inSlope: 0 outSlope: 0 @@ -512,7 +512,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 139.676 inSlope: 0 outSlope: 0 @@ -521,7 +521,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 271.124 inSlope: 0 outSlope: 0 @@ -530,7 +530,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.9166667 + time: 0.65 value: 139.676 inSlope: 0 outSlope: 0 @@ -539,7 +539,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: 180 inSlope: 0 outSlope: 0 @@ -569,7 +569,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 0 inSlope: 0 outSlope: 0 @@ -578,7 +578,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -587,7 +587,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: 0 inSlope: 0 outSlope: 0 @@ -617,7 +617,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 0 inSlope: 0 outSlope: 0 @@ -626,7 +626,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -635,7 +635,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: 0 inSlope: 0 outSlope: 0 @@ -665,7 +665,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 190.902 inSlope: 0 outSlope: 0 @@ -674,7 +674,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 177.707 inSlope: 0 outSlope: 0 @@ -683,7 +683,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: 180 inSlope: 0 outSlope: 0 @@ -713,7 +713,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 0 inSlope: 0 outSlope: 0 @@ -722,7 +722,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -731,7 +731,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: 0 inSlope: 0 outSlope: 0 @@ -761,7 +761,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 0 inSlope: 0 outSlope: 0 @@ -770,7 +770,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -779,7 +779,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: 0 inSlope: 0 outSlope: 0 @@ -809,7 +809,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 175.441 inSlope: 0 outSlope: 0 @@ -818,16 +818,16 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 187.54 - inSlope: 0.65460175 - outSlope: 0.65460175 + inSlope: 0.6546018 + outSlope: 0.6546018 tangentMode: 136 weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: 187.66 inSlope: 0 outSlope: 0 @@ -857,7 +857,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 0 inSlope: 0 outSlope: 0 @@ -866,7 +866,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -875,7 +875,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: 0 inSlope: 0 outSlope: 0 @@ -905,7 +905,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 0 inSlope: 0 outSlope: 0 @@ -914,7 +914,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -923,7 +923,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: 0 inSlope: 0 outSlope: 0 @@ -953,7 +953,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 168.801 inSlope: 0 outSlope: 0 @@ -962,16 +962,16 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 180.9 - inSlope: 0.66001236 - outSlope: 0.66001236 + inSlope: 0.6600124 + outSlope: 0.6600124 tangentMode: 136 weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 1.2333333 + time: 0.96666664 value: 181.021 inSlope: 0 outSlope: 0 @@ -1001,7 +1001,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 0 inSlope: 0 outSlope: 0 @@ -1010,7 +1010,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -1019,7 +1019,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.9166667 + time: 0.65 value: 0 inSlope: 0 outSlope: 0 @@ -1049,7 +1049,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 0 inSlope: 0 outSlope: 0 @@ -1058,7 +1058,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -1067,7 +1067,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.9166667 + time: 0.65 value: 0 inSlope: 0 outSlope: 0 @@ -1097,7 +1097,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5 + time: 0.23333333 value: 111.883 inSlope: 0 outSlope: 0 @@ -1106,7 +1106,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 1.817 inSlope: 0 outSlope: 0 @@ -1115,7 +1115,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.9166667 + time: 0.65 value: 111.883 inSlope: 0 outSlope: 0 @@ -1145,7 +1145,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -1175,7 +1175,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -1205,7 +1205,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 156.099 inSlope: 0 outSlope: 0 @@ -1235,7 +1235,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -1265,7 +1265,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 0 inSlope: 0 outSlope: 0 @@ -1295,7 +1295,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.4 value: 55.933 inSlope: 0 outSlope: 0 @@ -1312,114 +1312,6 @@ AnimationClip: script: {fileID: 0} flags: 16 m_EulerEditorCurves: - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_LocalEulerAngles.z - path: Torso - classID: 4 - script: {fileID: 0} - flags: 0 - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_LocalEulerAngles.y - path: Torso - classID: 4 - script: {fileID: 0} - flags: 0 - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_LocalEulerAngles.x - path: Torso - classID: 4 - script: {fileID: 0} - flags: 0 - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_LocalEulerAngles.z - path: Torso/Arm L/Arm L L - classID: 4 - script: {fileID: 0} - flags: 0 - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_LocalEulerAngles.y - path: Torso/Arm L/Arm L L - classID: 4 - script: {fileID: 0} - flags: 0 - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_LocalEulerAngles.x - path: Torso/Arm L/Arm L L - classID: 4 - script: {fileID: 0} - flags: 0 - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_LocalEulerAngles.z - path: Torso/Arm R/Arm R L - classID: 4 - script: {fileID: 0} - flags: 0 - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_LocalEulerAngles.y - path: Torso/Arm R/Arm R L - classID: 4 - script: {fileID: 0} - flags: 0 - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_LocalEulerAngles.x - path: Torso/Arm R/Arm R L - classID: 4 - script: {fileID: 0} - flags: 0 - serializedVersion: 2 curve: serializedVersion: 2 @@ -1499,7 +1391,7 @@ AnimationClip: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - attribute: m_LocalEulerAngles.x + attribute: m_LocalEulerAngles.z path: Torso/Arm R classID: 4 script: {fileID: 0} @@ -1523,11 +1415,119 @@ AnimationClip: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - attribute: m_LocalEulerAngles.z + attribute: m_LocalEulerAngles.x path: Torso/Arm R classID: 4 script: {fileID: 0} flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.z + path: Torso/Arm R/Arm R L + classID: 4 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.y + path: Torso/Arm R/Arm R L + classID: 4 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.x + path: Torso/Arm R/Arm R L + classID: 4 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.z + path: Torso + classID: 4 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.y + path: Torso + classID: 4 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.x + path: Torso + classID: 4 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.z + path: Torso/Arm L/Arm L L + classID: 4 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.y + path: Torso/Arm L/Arm L L + classID: 4 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.x + path: Torso/Arm L/Arm L L + classID: 4 + script: {fileID: 0} + flags: 0 - serializedVersion: 2 curve: serializedVersion: 2 diff --git a/Assets/Input System/Player Actions.inputactions b/Assets/Input System/Player Actions.inputactions index ee883f7..6b22971 100644 --- a/Assets/Input System/Player Actions.inputactions +++ b/Assets/Input System/Player Actions.inputactions @@ -23,6 +23,15 @@ "interactions": "", "initialStateCheck": false }, + { + "name": "Punch", + "type": "Button", + "id": "6fc12f4a-f346-4caf-a5f8-9d0f344122c3", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, { "name": "Join", "type": "Button", @@ -122,10 +131,65 @@ "isComposite": false, "isPartOfComposite": true }, + { + "name": "Arrow Keys", + "id": "9173ff2d-9797-4ef9-bc5b-cee95168ec6e", + "path": "Dpad", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "up", + "id": "f3aa205f-a912-46ce-9018-4534b3d77ae9", + "path": "/upArrow", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "7a97e1f5-1f55-46d9-9125-af294176511f", + "path": "/downArrow", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "159cfd41-0d56-432e-b56c-34814abf49bb", + "path": "/leftArrow", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "1a6aaa10-c994-4582-9e83-900289bd75da", + "path": "/rightArrow", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, { "name": "", "id": "6f8632d2-312f-4559-8fdd-d17a3c226436", - "path": "/e", + "path": "/space", "interactions": "", "processors": "", "groups": ";Keyboard&Mouse", @@ -165,6 +229,28 @@ "action": "Join", "isComposite": false, "isPartOfComposite": false + }, + { + "name": "", + "id": "579f259d-1883-4fa5-bb3f-e564431fd795", + "path": "/e", + "interactions": "", + "processors": "", + "groups": "", + "action": "Punch", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "b2af80b4-883d-4a96-982d-c1fa16fd900d", + "path": "/buttonWest", + "interactions": "", + "processors": "", + "groups": "", + "action": "Punch", + "isComposite": false, + "isPartOfComposite": false } ] }, diff --git a/Assets/Prefabs/Bones.prefab b/Assets/Prefabs/Bones.prefab index 391bb7f..d14abe2 100644 --- a/Assets/Prefabs/Bones.prefab +++ b/Assets/Prefabs/Bones.prefab @@ -16,6 +16,7 @@ GameObject: - component: {fileID: 1169583671018505929} - component: {fileID: 2344147968324054325} - component: {fileID: 8121950008105218343} + - component: {fileID: 5190430079571461372} m_Layer: 0 m_Name: Bones m_TagString: Untagged @@ -224,6 +225,18 @@ BoxCollider2D: m_AutoTiling: 0 m_Size: {x: 0.4505486, y: 1.9777327} m_EdgeRadius: 0 +--- !u!114 &5190430079571461372 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1375850422501237868} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9ae332d743f1a42ce8ee7a958853bcc1, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1648017802882051395 GameObject: m_ObjectHideFlags: 0 @@ -250,13 +263,13 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1648017802882051395} serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0.013222396, w: -0.9999126} + m_LocalRotation: {x: -0, y: -0, z: -0.33692652, w: -0.94153094} m_LocalPosition: {x: 0, y: -0.5, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4818486997278545909} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 1.515} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 39.379} --- !u!212 &5602021945915386438 SpriteRenderer: m_ObjectHideFlags: 0 @@ -1195,13 +1208,13 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5600043765235685887} serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: 0.31969908, w: 0.9475191} m_LocalPosition: {x: 0, y: -0.5, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3359136527054329610} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 37.289} --- !u!212 &1263635959652575642 SpriteRenderer: m_ObjectHideFlags: 0 diff --git a/Assets/Punch.cs b/Assets/Punch.cs new file mode 100644 index 0000000..ec1cc2c --- /dev/null +++ b/Assets/Punch.cs @@ -0,0 +1,22 @@ +using UnityEngine; +using UnityEngine.InputSystem; + +[RequireComponent(typeof(PlayerInput))] +[RequireComponent(typeof(AnimationPlayer))] +public class Punch : MonoBehaviour +{ + InputActionAsset actions; + + private void Start() + { + actions = GetComponent().actions; + } + + private void Update() + { + if (actions.FindAction("Punch").ReadValue() == 1f) + { + GetComponent().Punch(); + } + } +} diff --git a/Assets/Punch.cs.meta b/Assets/Punch.cs.meta new file mode 100644 index 0000000..d0e13ae --- /dev/null +++ b/Assets/Punch.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9ae332d743f1a42ce8ee7a958853bcc1 \ No newline at end of file diff --git a/Assets/Scripts/AnimationPlayer.cs b/Assets/Scripts/AnimationPlayer.cs index 99b29d8..81e2610 100644 --- a/Assets/Scripts/AnimationPlayer.cs +++ b/Assets/Scripts/AnimationPlayer.cs @@ -28,4 +28,9 @@ public class AnimationPlayer : MonoBehaviour { this.state = state; } + + public void Punch() + { + animator.SetTrigger("punch"); + } }