diff options
Diffstat (limited to 'Assets/Scripts/Unit/UnitRootMotion.cs')
-rw-r--r-- | Assets/Scripts/Unit/UnitRootMotion.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Assets/Scripts/Unit/UnitRootMotion.cs b/Assets/Scripts/Unit/UnitRootMotion.cs index 58ae814e..c4d4b2c9 100644 --- a/Assets/Scripts/Unit/UnitRootMotion.cs +++ b/Assets/Scripts/Unit/UnitRootMotion.cs @@ -72,7 +72,14 @@ public class UnitRootMotion : UnitComponent {
Vector3 dest = m_Owner.unitAnimation.animator.deltaPosition;
dest.x = 0; //限制x轴始终在x=0
- m_Owner.transform.position += dest;
+
+ var state = m_Owner.unitAnimation.layers[0].stateInfo;
+ if(state.IsTag("IgnoreY"))
+ {
+ dest.y = 0;
+ }
+
+ m_Owner.transform.position += dest;
}
#endif
|