diff options
Diffstat (limited to 'Assets/Scripts/Unit/Component/UnitAnimation.cs')
-rw-r--r-- | Assets/Scripts/Unit/Component/UnitAnimation.cs | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/Assets/Scripts/Unit/Component/UnitAnimation.cs b/Assets/Scripts/Unit/Component/UnitAnimation.cs index a6a7f3eb..4532023d 100644 --- a/Assets/Scripts/Unit/Component/UnitAnimation.cs +++ b/Assets/Scripts/Unit/Component/UnitAnimation.cs @@ -286,6 +286,9 @@ public class UnitAnimation : UnitComponent public AnimatorLayerInfo[] layers { get { return m_LayerInfo; } }
private readonly AnimatorLayerInfo[] m_LayerInfo = new AnimatorLayerInfo[(int)ELayer.Count];
+ public bool applyRootMotion { get; set; }// 动态设置root motion
+ public bool applyRootCurve { get; set; } // 程序生成的root motion
+
public bool isInTransition
{
get
@@ -309,6 +312,8 @@ public class UnitAnimation : UnitComponent {
LogHelper.LogError("没有挂Animator组件");
}
+
+ applyRootMotion = true;
}
public override void OnUpdate()
@@ -317,8 +322,12 @@ public class UnitAnimation : UnitComponent UpdateLayer();
UpdateAnimation();
- UpdateRootMotion();
- }
+
+ if(applyRootMotion)
+ UpdateRootMotion();
+ if(applyRootCurve)
+ UpdateRootCurve();
+ }
void UpdateLayer()
{
@@ -342,7 +351,13 @@ public class UnitAnimation : UnitComponent m_Owner.unitRootMotion.UpdateRootMotion();
}
- public void AnimIdle()
+ void UpdateRootCurve()
+ {
+
+ }
+
+
+ public void AnimIdle()
{
#if ANIM_CROSS_FADE
m_Animator.CrossFade("Idle", 0.2f, 0);
@@ -394,7 +409,19 @@ public class UnitAnimation : UnitComponent #endif
}
- public void AnimLanding()
+ public void AnimAirDash()
+ {
+ if (layers[0].stateInfo.IsName("AirDash"))
+ {
+ m_Animator.Play("AirDash", 0, 0);
+ }
+ else
+ {
+ m_Animator.CrossFade("AirDash", 0.05f);
+ }
+ }
+
+ public void AnimLanding()
{
#if ANIM_CROSS_FADE
m_Animator.CrossFade("Landing", 0.05f);
|