From 134f1deb971b0514a26e04e23926f91983a5497f Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Wed, 13 Mar 2024 11:38:18 +0800 Subject: * move --- _ActiveRagdoll/SetAnimationByInput.cs | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 _ActiveRagdoll/SetAnimationByInput.cs (limited to '_ActiveRagdoll/SetAnimationByInput.cs') diff --git a/_ActiveRagdoll/SetAnimationByInput.cs b/_ActiveRagdoll/SetAnimationByInput.cs new file mode 100644 index 0000000..cc50e5a --- /dev/null +++ b/_ActiveRagdoll/SetAnimationByInput.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +public class SetAnimationByInput : MonoBehaviour +{ + private InputHandler input; + + private AnimationHandler anim; + + private StandingDataHandler standingData; + + private void Start() + { + anim = GetComponent(); + input = GetComponent(); + standingData = GetComponent(); + } + + private void Update() + { + if ((double)standingData.sinceGrounded > 0.2) + { + anim.animationState = 3; + } + else if (input.inputMovementDirection.magnitude > 0.1f) + { + if (input.isSpringting) + { + anim.animationState = 1; + } + else + { + anim.animationState = 2; + } + } + else + { + anim.animationState = 0; + } + } +} -- cgit v1.1-26-g67d0