summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs')
-rw-r--r--Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs28
1 files changed, 18 insertions, 10 deletions
diff --git a/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs b/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs
index 33bd4d4e..dbd4dd49 100644
--- a/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs
+++ b/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs
@@ -71,6 +71,8 @@ public class PCAnimation : UnitAnimation
public bool applyRootMotion { get; set; }// 动态设置root motion
public bool applyRootCurve { get; set; } // 程序生成的root motion
+ public bool updateAnimationAuto { get; private set; } // 自动更新动画
+
public override void Initialize()
{
base.Initialize();
@@ -89,7 +91,9 @@ public class PCAnimation : UnitAnimation
}
applyRootMotion = true;
- }
+
+ updateAnimationAuto = true;
+ }
public override void OnUpdate()
{
@@ -97,11 +101,8 @@ public class PCAnimation : UnitAnimation
UpdateLayer();
UpdateAnimation();
-
- if (applyRootMotion)
- UpdateRootMotion();
- if (applyRootCurve)
- UpdateRootCurve();
+ UpdateRootMotion();
+ UpdateRootCurve();
}
void UpdateLayer()
@@ -116,18 +117,25 @@ public class PCAnimation : UnitAnimation
void UpdateAnimation()
{
- m_Animator.speed = 1;
- m_Animator.Update(Time.deltaTime);
- m_Animator.speed = 0;
- }
+ if(updateAnimationAuto)
+ {
+ m_Animator.speed = 1;
+ m_Animator.Update(Time.deltaTime);
+ m_Animator.speed = 0;
+ }
+ }
void UpdateRootMotion()
{
+ if (!applyRootMotion)
+ return;
m_Owner.unitRootMotion.UpdateRootMotion();
}
void UpdateRootCurve()
{
+ if (!applyRootCurve)
+ return;
}
public void AnimIdle()