From 52cdc284baa5b95d290dc27dd95fc691aff7c851 Mon Sep 17 00:00:00 2001 From: Sveske Juice Date: Sat, 3 Feb 2024 17:56:12 -0800 Subject: [PATCH 1/2] l --- .../Player1/PlayerAnimations1.controller | 16 +- .../PlayerAnimations/Player1/Swing/Swing.anim | 89 ++++++++-- .../Player2/PlayerAnimations2.controller | 168 +++++------------- Assets/Scripts/Enemy/EnemyAnimationHandler.cs | 3 - .../Scripts/Player/PlayerAnimationHandler.cs | 4 +- Assets/Scripts/Player/PlayerMovement.cs | 6 +- 6 files changed, 145 insertions(+), 141 deletions(-) diff --git a/Assets/Animations/PlayerAnimations/Player1/PlayerAnimations1.controller b/Assets/Animations/PlayerAnimations/Player1/PlayerAnimations1.controller index 2256c74..08c43f1 100644 --- a/Assets/Animations/PlayerAnimations/Player1/PlayerAnimations1.controller +++ b/Assets/Animations/PlayerAnimations/Player1/PlayerAnimations1.controller @@ -154,31 +154,37 @@ AnimatorController: m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: Run m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: Mop m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: RunMop m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: Swing m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} + - m_Name: IsRunning + m_Type: 4 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer diff --git a/Assets/Animations/PlayerAnimations/Player1/Swing/Swing.anim b/Assets/Animations/PlayerAnimations/Player1/Swing/Swing.anim index 6576677..3e63c65 100644 --- a/Assets/Animations/PlayerAnimations/Player1/Swing/Swing.anim +++ b/Assets/Animations/PlayerAnimations/Player1/Swing/Swing.anim @@ -16,25 +16,55 @@ AnimationClip: m_EulerCurves: [] m_PositionCurves: [] m_ScaleCurves: [] - m_FloatCurves: [] + m_FloatCurves: + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.85 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_FlipX + path: + classID: 212 + script: {fileID: 0} + flags: 0 m_PPtrCurves: - serializedVersion: 2 curve: - time: 0 value: {fileID: 21300000, guid: 240c3a2ef21982f4590d6cd434d91f27, type: 3} - - time: 0.06666667 + - time: 0.11666667 value: {fileID: 21300000, guid: 0bac1dfd4dd5df344ade6d0dfc5aa77f, type: 3} - - time: 0.15 + - time: 0.25 value: {fileID: 21300000, guid: 2f7b336ea4b22104b831a5aa4ce63e65, type: 3} - - time: 0.21666667 + - time: 0.36666667 value: {fileID: 21300000, guid: db90fe6a45c83a74b88da01e595e40ed, type: 3} - - time: 0.28333333 + - time: 0.48333332 value: {fileID: 21300000, guid: d8c1ff9b90b62814bbb6894bfcf4b2bb, type: 3} - - time: 0.35 + - time: 0.6 value: {fileID: 21300000, guid: de98b85f0c0593e4389e93a6542ba161, type: 3} - - time: 0.43333334 + - time: 0.73333335 value: {fileID: 21300000, guid: b9a4237d2fdcb3044a222171250fa5fc, type: 3} - - time: 0.5 + - time: 0.85 value: {fileID: 21300000, guid: 670971dc022801d4aa435f32749cdf05, type: 3} attribute: m_Sprite path: @@ -48,6 +78,15 @@ AnimationClip: m_Extent: {x: 0, y: 0, z: 0} m_ClipBindingConstant: genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 555744692 + script: {fileID: 0} + typeID: 212 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 - serializedVersion: 2 path: 0 attribute: 0 @@ -71,7 +110,7 @@ AnimationClip: m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 0.51666665 + m_StopTime: 0.8666667 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 @@ -86,7 +125,37 @@ AnimationClip: m_KeepOriginalPositionXZ: 0 m_HeightFromFeet: 0 m_Mirror: 0 - m_EditorCurves: [] + m_EditorCurves: + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.85 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_FlipX + path: + classID: 212 + script: {fileID: 0} + flags: 0 m_EulerEditorCurves: [] m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 diff --git a/Assets/Animations/PlayerAnimations/Player2/PlayerAnimations2.controller b/Assets/Animations/PlayerAnimations/Player2/PlayerAnimations2.controller index c52c14e..053efc1 100644 --- a/Assets/Animations/PlayerAnimations/Player2/PlayerAnimations2.controller +++ b/Assets/Animations/PlayerAnimations/Player2/PlayerAnimations2.controller @@ -1,6 +1,6 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1101 &-8901018507176659324 +--- !u!1101 &-8701045174356781676 AnimatorStateTransition: m_ObjectHideFlags: 1 m_CorrespondingSourceObject: {fileID: 0} @@ -9,10 +9,10 @@ AnimatorStateTransition: m_Name: m_Conditions: - m_ConditionMode: 1 - m_ConditionEvent: Mop + m_ConditionEvent: IsRunning m_EventTreshold: 0 m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: 2168268571006691905} + m_DstState: {fileID: 8304111510876962717} m_Solo: 0 m_Mute: 0 m_IsExit: 0 @@ -20,32 +20,7 @@ AnimatorStateTransition: 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: 1 ---- !u!1101 &-6015651985154535813 -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: Idle - m_EventTreshold: 0 - m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: 3357306648811348641} - m_Solo: 0 - m_Mute: 0 - m_IsExit: 0 - serializedVersion: 3 - m_TransitionDuration: 0.25 - m_TransitionOffset: 0 - m_ExitTime: 0.75 - m_HasExitTime: 0 + m_HasExitTime: 1 m_HasFixedDuration: 1 m_InterruptionSource: 0 m_OrderedInterruption: 1 @@ -61,7 +36,7 @@ AnimatorStateMachine: m_ChildStates: - serializedVersion: 1 m_State: {fileID: 3357306648811348641} - m_Position: {x: 10, y: 30, z: 0} + m_Position: {x: 20, y: -30, z: 0} - serializedVersion: 1 m_State: {fileID: -944807189804630194} m_Position: {x: 530, y: 80, z: 0} @@ -70,25 +45,45 @@ AnimatorStateMachine: m_Position: {x: 530, y: 170, z: 0} - serializedVersion: 1 m_State: {fileID: 8304111510876962717} - m_Position: {x: 520, y: -40, z: 0} + m_Position: {x: 300, y: 80, z: 0} - serializedVersion: 1 m_State: {fileID: 2168268571006691905} m_Position: {x: 530, y: 20, z: 0} m_ChildStateMachines: [] - m_AnyStateTransitions: - - {fileID: -6015651985154535813} - - {fileID: 8165869328345691628} - - {fileID: -8901018507176659324} - - {fileID: 3114296213374972739} - - {fileID: 5930657296870268193} + m_AnyStateTransitions: [] m_EntryTransitions: [] m_StateMachineTransitions: {} m_StateMachineBehaviours: [] - m_AnyStatePosition: {x: 270, y: 60, z: 0} + m_AnyStatePosition: {x: -110, y: -130, z: 0} m_EntryPosition: {x: 20, y: 160, z: 0} m_ExitPosition: {x: 800, y: 120, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} m_DefaultState: {fileID: 3357306648811348641} +--- !u!1101 &-2173210327374923992 +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: IsRunning + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 3357306648811348641} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.516129 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1102 &-944807189804630194 AnimatorState: serializedVersion: 6 @@ -129,31 +124,37 @@ AnimatorController: m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: Run m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: Mop m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: Swing m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: RunMop m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} + - m_Name: IsRunning + m_Type: 4 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -193,31 +194,6 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: ---- !u!1101 &3114296213374972739 -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: Swing - m_EventTreshold: 0 - m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: -944807189804630194} - m_Solo: 0 - m_Mute: 0 - m_IsExit: 0 - serializedVersion: 3 - 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: 1 --- !u!1102 &3357306648811348641 AnimatorState: serializedVersion: 6 @@ -228,7 +204,8 @@ AnimatorState: m_Name: Idle m_Speed: 1 m_CycleOffset: 0 - m_Transitions: [] + m_Transitions: + - {fileID: -8701045174356781676} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -270,56 +247,6 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: ---- !u!1101 &5930657296870268193 -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: RunMop - m_EventTreshold: 0 - m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: 3748437463534410733} - m_Solo: 0 - m_Mute: 0 - m_IsExit: 0 - serializedVersion: 3 - 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: 1 ---- !u!1101 &8165869328345691628 -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: 0} - m_DstState: {fileID: 8304111510876962717} - m_Solo: 0 - m_Mute: 0 - m_IsExit: 0 - serializedVersion: 3 - 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: 1 --- !u!1102 &8304111510876962717 AnimatorState: serializedVersion: 6 @@ -330,7 +257,8 @@ AnimatorState: m_Name: Running m_Speed: 1 m_CycleOffset: 0 - m_Transitions: [] + m_Transitions: + - {fileID: -2173210327374923992} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 diff --git a/Assets/Scripts/Enemy/EnemyAnimationHandler.cs b/Assets/Scripts/Enemy/EnemyAnimationHandler.cs index a510a5f..81482d0 100644 --- a/Assets/Scripts/Enemy/EnemyAnimationHandler.cs +++ b/Assets/Scripts/Enemy/EnemyAnimationHandler.cs @@ -6,7 +6,6 @@ using UnityEngine.AI; public class EnemyAnimationHandler : MonoBehaviour { Animator animator; - bool isDying = false; void Start() { animator = GetComponent(); @@ -25,7 +24,6 @@ public class EnemyAnimationHandler : MonoBehaviour IEnumerator AnimationDie() { - isDying = true; Strangle(); Debug.Log("Strangle"); yield return new WaitForSecondsRealtime(0.1f); @@ -43,6 +41,5 @@ public class EnemyAnimationHandler : MonoBehaviour public void DestroyGameobject() { Destroy(transform.parent.gameObject); - } } diff --git a/Assets/Scripts/Player/PlayerAnimationHandler.cs b/Assets/Scripts/Player/PlayerAnimationHandler.cs index 13a8fa5..02cc3e5 100644 --- a/Assets/Scripts/Player/PlayerAnimationHandler.cs +++ b/Assets/Scripts/Player/PlayerAnimationHandler.cs @@ -15,9 +15,9 @@ public class PlayerAnimationHandler : MonoBehaviour { animator.SetTrigger("Idle"); } - public void Run() + public void Run(bool state) { - animator.SetTrigger("Run"); + animator.SetBool("IsRunning", state); } public void Swing() { diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index 621fc97..3055fed 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -49,7 +49,11 @@ public class PlayerMovement : MonoBehaviour if (playerInput.movement != Vector2.zero) { RumbleWalk(); - animationHandler.Run(); + animationHandler.Run(true); + } + else + { + animationHandler.Run(false); } } private void FixedUpdate() From dbef2ea752a599f0b57bf61f36c8211e96ad01e3 Mon Sep 17 00:00:00 2001 From: Sveske Juice Date: Sat, 3 Feb 2024 17:57:37 -0800 Subject: [PATCH 2/2] fix err --- Assets/Scripts/Enemy/EnemyAnimationHandler.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Assets/Scripts/Enemy/EnemyAnimationHandler.cs b/Assets/Scripts/Enemy/EnemyAnimationHandler.cs index 50dede7..3c902f3 100644 --- a/Assets/Scripts/Enemy/EnemyAnimationHandler.cs +++ b/Assets/Scripts/Enemy/EnemyAnimationHandler.cs @@ -6,6 +6,7 @@ using UnityEngine.AI; public class EnemyAnimationHandler : MonoBehaviour { Animator animator; + bool isDying = false; void Start() { animator = GetComponent(); @@ -20,6 +21,7 @@ public class EnemyAnimationHandler : MonoBehaviour //GetComponent().enabled = false; if (!isDying) StartCoroutine(AnimationDie()); + isDying = true; } IEnumerator AnimationDie()