summaryrefslogtreecommitdiff
path: root/ActiveRagdoll/Assets/TABG/Scripts/Animation/AnimationObject.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-04-16 15:12:46 +0800
committerchai <215380520@qq.com>2024-04-16 15:12:46 +0800
commit84fcf0834583d755c1cfdb90d2b93e8ad2964065 (patch)
treee2ad33902ae36b49617b05362715e75ae12dfe25 /ActiveRagdoll/Assets/TABG/Scripts/Animation/AnimationObject.cs
parent80983c575ec565078f757f638f3726708647080a (diff)
*misc
Diffstat (limited to 'ActiveRagdoll/Assets/TABG/Scripts/Animation/AnimationObject.cs')
-rw-r--r--ActiveRagdoll/Assets/TABG/Scripts/Animation/AnimationObject.cs24
1 files changed, 14 insertions, 10 deletions
diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Animation/AnimationObject.cs b/ActiveRagdoll/Assets/TABG/Scripts/Animation/AnimationObject.cs
index 9e9039f..b7ef84a 100644
--- a/ActiveRagdoll/Assets/TABG/Scripts/Animation/AnimationObject.cs
+++ b/ActiveRagdoll/Assets/TABG/Scripts/Animation/AnimationObject.cs
@@ -11,7 +11,7 @@ namespace Rigging.Animations
public class AnimationObject : MonoBehaviour
{
- public PhysicsAnimation[] animations;
+ public AnimationParam<PhysicsAnimation> animations;
private Rigidbody rig;
@@ -43,9 +43,9 @@ namespace Rigging.Animations
private void Start()
{
- animationHandler = base.transform.root.GetComponent<AnimationHandler>();
+ animationHandler = base.transform.root.GetComponentInChildren<AnimationHandler>();
rig = GetComponent<Rigidbody>();
- stepHandler = base.transform.root.GetComponent<StepHandler>();
+ stepHandler = base.transform.root.GetComponentInChildren<StepHandler>();
//holding = base.transform.root.GetComponent<Holding>();
//death = base.transform.root.GetComponent<PlayerDeath>();
Hip componentInChildren = base.transform.root.GetComponentInChildren<Hip>();
@@ -53,10 +53,14 @@ namespace Rigging.Animations
{
hip = componentInChildren.transform;
}
+
+ animations.SetPlayer(transform.root.GetComponent<Player>());
}
private void FixedUpdate()
{
+
+ return;
//if ((bool)death)
//{
// if (death.muscleFunction < 0f)
@@ -81,24 +85,24 @@ namespace Rigging.Animations
Vector3 vector = Vector3.zero;
if (isCurrentlyLeft == isLeft)
{
- Vector3 forwardForce = animations[animationHandler.animationState].forwardForce;
- if (animations[animationHandler.animationState].forceSpace == PhysicsAnimation.ForceSpace.World)
+ Vector3 forwardForce = animations.current.forwardForce;
+ if (animations.current.forceSpace == PhysicsAnimation.ForceSpace.World)
{
vector = forwardForce;
}
- if (animations[animationHandler.animationState].forceSpace == PhysicsAnimation.ForceSpace.Hip)
+ if (animations.current.forceSpace == PhysicsAnimation.ForceSpace.Hip)
{
vector = hip.TransformDirection(forwardForce);
}
}
else
{
- Vector3 backwardsForce = animations[animationHandler.animationState].backwardsForce;
- if (animations[animationHandler.animationState].forceSpace == PhysicsAnimation.ForceSpace.World)
+ Vector3 backwardsForce = animations.current.backwardsForce;
+ if (animations.current.forceSpace == PhysicsAnimation.ForceSpace.World)
{
vector = backwardsForce;
}
- if (animations[animationHandler.animationState].forceSpace == PhysicsAnimation.ForceSpace.Hip)
+ if (animations.current.forceSpace == PhysicsAnimation.ForceSpace.Hip)
{
vector = hip.TransformDirection(backwardsForce);
}
@@ -108,7 +112,7 @@ namespace Rigging.Animations
private void AddTorque()
{
- Vector3 vector = ((isCurrentlyLeft != isLeft) ? hip.TransformDirection(animations[animationHandler.animationState].backwardsTorque) : hip.TransformDirection(animations[animationHandler.animationState].forwardTorque));
+ Vector3 vector = ((isCurrentlyLeft != isLeft) ? hip.TransformDirection(animations.current.backwardsTorque) : hip.TransformDirection(animations.current.forwardTorque));
rig.AddTorque(vector * muscleMultiplier * multiplier, ForceMode.Acceleration);
}