From 07fd372981a16672af23e30816ade14fcb744804 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 30 Aug 2021 13:49:30 +0800 Subject: =?UTF-8?q?=E5=87=BB=E4=B8=AD=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Unit/Component/MonsterState.cs | 40 ++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'Assets/Scripts/Unit/Component/MonsterState.cs') diff --git a/Assets/Scripts/Unit/Component/MonsterState.cs b/Assets/Scripts/Unit/Component/MonsterState.cs index 2beba0d5..b1ff9cbd 100644 --- a/Assets/Scripts/Unit/Component/MonsterState.cs +++ b/Assets/Scripts/Unit/Component/MonsterState.cs @@ -14,6 +14,7 @@ public class MonsterState : UnitState Move, + HitLight, HitAir, HitGround, HitFall, @@ -73,23 +74,25 @@ public class MonsterState : UnitState public struct LandingParam { } + public struct HitLightParam { } + #region Idle IEnumerator Idle(IdleParam param) { - if (m_Owner.isInAir) // 浮空切换到landing - { - ChangeState(EUnitState.Landing, new LandingParam()); - } - else // idle - { + //if (m_Owner.isInAir) // 浮空切换到landing + //{ + // ChangeState(EUnitState.Landing, new LandingParam()); + //} + //else // idle + //{ m_Owner.SetYPosition(0); m_Owner.monsterAnimation.AnimIdle(); while (true) { yield return null; } - } + //} } void OnIdleExit(EUnitState nextState) @@ -97,5 +100,28 @@ public class MonsterState : UnitState } #endregion + #region HitLight + + IEnumerator HitLight(HitLightParam param) + { + m_Owner.monsterAnimation.AnimHitLight(); + yield return null; + while (true) + { + bool reachEnd = m_Owner.monsterAnimation.layers[0].playbackNomralizedTime == 1; + if(reachEnd) + { + ChangeState(EUnitState.Idle, new IdleParam()); + } + yield return null; + } + } + + void OnHitLightExit(EUnitState nextState) + { + } + + #endregion + } \ No newline at end of file -- cgit v1.1-26-g67d0