From e2284510c40e2d637c28108b50df2e403d51ec1c Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 27 Aug 2021 18:53:44 +0800 Subject: *crossfade --- Assets/Scripts/Unit/Component/UnitState.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'Assets/Scripts/Unit/Component/UnitState.cs') diff --git a/Assets/Scripts/Unit/Component/UnitState.cs b/Assets/Scripts/Unit/Component/UnitState.cs index e27aa00b..7a731b02 100644 --- a/Assets/Scripts/Unit/Component/UnitState.cs +++ b/Assets/Scripts/Unit/Component/UnitState.cs @@ -120,7 +120,7 @@ public class UnitState : UnitComponent { if(m_Owner.isInAir) // 浮空切换到landing { - + ChangeState(EUnitState.Landing, new LandingParam()); } else // idle { @@ -151,7 +151,6 @@ public class UnitState : UnitComponent void OnIdleExit(EUnitState nextState) { - m_Owner.unitAnimation.animator.ResetTrigger("ToIdle"); } #endregion @@ -208,13 +207,16 @@ public class UnitState : UnitComponent IEnumerator AirAttack(SkillParam param) { - m_Owner.unitAnimation.AnimAirAttack(); + int id = 0; + m_Owner.unitAnimation.AnimAirAttack(id); + yield return null; // 等待animator更新 while (true) { bool canAttack = m_Owner.unitAnimation.layers[0].IsToggleOpen(EAnimationToogle.Combo); if(canAttack && Input.GetKeyDown("j") ) { - m_Owner.unitAnimation.AnimAirAttack(); + ++id; + m_Owner.unitAnimation.AnimAirAttack(id); yield return null; // 等待animator更新 yield return new WaitForTransitionDone(m_Owner.unitAnimation); } @@ -267,8 +269,10 @@ public class UnitState : UnitComponent IEnumerator Landing(LandingParam param) { m_Owner.unitAnimation.AnimLanding(); + yield return null; + yield return new WaitForTransitionDone(m_Owner.unitAnimation); float vy = 0; - float g = 9.8f * 1.5f; + float g = 9.8f; bool landingGround = false; while (true) { @@ -281,10 +285,12 @@ public class UnitState : UnitComponent if(pos.y > 0 && pos.y <= 1 && !landingGround) { landingGround = true; - m_Owner.unitAnimation.AnimLanding(); + m_Owner.unitAnimation.AnimLandingGround(); } if(pos.y <= 0) { + pos.y = 0; + m_Owner.transform.position = pos; ChangeState(EUnitState.Idle, new IdleParam()); } yield return null; -- cgit v1.1-26-g67d0