From 42d8f6778684f3af761c3355cd5eadce8edba491 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Wed, 17 Apr 2024 01:23:53 +0800 Subject: * run --- .../Assets/TABG/Scripts/Action/Movement.cs | 13 ++--------- .../TABG/Scripts/Animation/AnimationObject.cs | 27 +--------------------- ActiveRagdoll/Assets/TABG/Scripts/Body/LegRight.cs | 2 +- .../TABG/Scripts/Data/SetAnimationByInput.cs | 2 +- .../Assets/TABG/Scripts/Data/StepHandler.cs | 27 +++++++++++++--------- 5 files changed, 21 insertions(+), 50 deletions(-) (limited to 'ActiveRagdoll/Assets/TABG/Scripts') diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Action/Movement.cs b/ActiveRagdoll/Assets/TABG/Scripts/Action/Movement.cs index 8cc245d..67e9a05 100644 --- a/ActiveRagdoll/Assets/TABG/Scripts/Action/Movement.cs +++ b/ActiveRagdoll/Assets/TABG/Scripts/Action/Movement.cs @@ -1,5 +1,6 @@ using Rigging.Data; using Rigging.Inputs; +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -18,8 +19,6 @@ namespace Rigging.Action public AnimationParam animationForceAmounts; - private AnimationHandler animationHandler; - private RigidbodyHolder allRigs; public AnimationCurve jumpCurve; @@ -30,21 +29,14 @@ namespace Rigging.Action private MovementDataHandler data; - //private PlayerDeath death; - - [HideInInspector] + [HideInInspector, NonSerialized] public float multiplier = 1f; - //private WobbleShake wobbleShake; - protected override void OnStart() { animationForceAmounts.SetPlayer(player); - //wobbleShake = GetComponentInChildren(); - //death = GetComponent(); standingData = player.status.standingData; inputHandler = player.input; - animationHandler = player.status.animation; allRigs = player.status.body; data = player.status.movementData; } @@ -64,7 +56,6 @@ namespace Rigging.Action { data.sinceJump = 0f; StartCoroutine(AddJumpForce()); - //wobbleShake.AddShake(Vector3.up * 2f, 0.8f); } } diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Animation/AnimationObject.cs b/ActiveRagdoll/Assets/TABG/Scripts/Animation/AnimationObject.cs index b7ef84a..a194cf1 100644 --- a/ActiveRagdoll/Assets/TABG/Scripts/Animation/AnimationObject.cs +++ b/ActiveRagdoll/Assets/TABG/Scripts/Animation/AnimationObject.cs @@ -33,22 +33,13 @@ namespace Rigging.Animations public bool dontAnimateIfHoldingSomething; - //private Holding holding; - - private AnimationHandler animationHandler; - - //private PlayerDeath death; - private float muscleMultiplier = 1f; private void Start() { - animationHandler = base.transform.root.GetComponentInChildren(); rig = GetComponent(); stepHandler = base.transform.root.GetComponentInChildren(); - //holding = base.transform.root.GetComponent(); - //death = base.transform.root.GetComponent(); - Hip componentInChildren = base.transform.root.GetComponentInChildren(); + Rigging.BodyPart.Hip componentInChildren = base.transform.root.GetComponentInChildren(); if ((bool)componentInChildren) { hip = componentInChildren.transform; @@ -59,22 +50,6 @@ namespace Rigging.Animations private void FixedUpdate() { - - return; - //if ((bool)death) - //{ - // if (death.muscleFunction < 0f) - // { - // return; - // } - // muscleMultiplier = death.muscleFunction; - //} - //if ((!holding || !dontAnimateIfHoldingSomething || !holding.heldObject) && animationHandler.animationState < animations.Length) - //{ - // SetMultiplier(); - // AddTorque(); - // AddForce(); - //} SetMultiplier(); AddTorque(); AddForce(); diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Body/LegRight.cs b/ActiveRagdoll/Assets/TABG/Scripts/Body/LegRight.cs index 77281a1..f690825 100644 --- a/ActiveRagdoll/Assets/TABG/Scripts/Body/LegRight.cs +++ b/ActiveRagdoll/Assets/TABG/Scripts/Body/LegRight.cs @@ -3,7 +3,7 @@ using UnityEngine; namespace Rigging.BodyPart { - public class LegRight : MonoBehaviour + public class LegRight : BodyPartBase { private void Start() { diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Data/SetAnimationByInput.cs b/ActiveRagdoll/Assets/TABG/Scripts/Data/SetAnimationByInput.cs index 98444e3..c2a206b 100644 --- a/ActiveRagdoll/Assets/TABG/Scripts/Data/SetAnimationByInput.cs +++ b/ActiveRagdoll/Assets/TABG/Scripts/Data/SetAnimationByInput.cs @@ -25,7 +25,7 @@ namespace Rigging.Data { if ((double)standingData.sinceGrounded > 0.2) { - anim.animationState = 3; // jump + //anim.animationState = 3; // jump } else if (input.inputMovementDirection.magnitude > 0.1f) { diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Data/StepHandler.cs b/ActiveRagdoll/Assets/TABG/Scripts/Data/StepHandler.cs index 3caa488..4e6ebed 100644 --- a/ActiveRagdoll/Assets/TABG/Scripts/Data/StepHandler.cs +++ b/ActiveRagdoll/Assets/TABG/Scripts/Data/StepHandler.cs @@ -1,4 +1,5 @@ using Rigging.BodyPart; +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -15,15 +16,13 @@ namespace Rigging.Data public bool isLeft;//左脚还是右脚在前面 - private float counter; + public float counter; - private Transform leftLeg; + public Transform leftLeg; - private Transform rightLeg; + public Transform rightLeg; - private AnimationHandler animationHandler; - - private Transform hip; + public Transform hip; protected override void OnStart() { @@ -31,7 +30,6 @@ namespace Rigging.Data { leftLeg = player.body.legLeft.transform; rightLeg = player.body.legRight.transform; - animationHandler = player.status.animation; hip = player.body.hip.transform; } steps.SetPlayer(player); @@ -47,9 +45,11 @@ namespace Rigging.Data Switch(); } } - else if (counter > steps.current.minTime - && (steps.current.minAngle == 0f || steps.current.minAngle < Vector3.Angle(leftLeg.forward, rightLeg.forward)) - && isLeft == hip.InverseTransformPoint(leftLeg.position + leftLeg.forward).z > hip.InverseTransformPoint(rightLeg.position + rightLeg.forward).z) + else if ( counter > steps.current.minTime + //&& (steps.current.minAngle == 0f || steps.current.minAngle < Vector3.Angle(leftLeg.forward, rightLeg.forward)) + //&& (steps.current.minAngle == 0f || steps.current.minAngle < Vector3.Angle(leftLeg.forward, rightLeg.forward)) + //&& isLeft == hip.InverseTransformPoint(leftLeg.position + leftLeg.forward).z > hip.InverseTransformPoint(rightLeg.position + rightLeg.forward).z + ) { Switch(); } @@ -61,6 +61,11 @@ namespace Rigging.Data counter = 0f; } + public void OnGUI() + { + GUILayout.Label(isLeft.ToString()); + } + } -} \ No newline at end of file +} \ No newline at end of file -- cgit v1.1-26-g67d0