diff options
Diffstat (limited to 'Assets/Scripts/Unit/Component/PCState.cs')
-rw-r--r-- | Assets/Scripts/Unit/Component/PCState.cs | 79 |
1 files changed, 53 insertions, 26 deletions
diff --git a/Assets/Scripts/Unit/Component/PCState.cs b/Assets/Scripts/Unit/Component/PCState.cs index 594ae131..1b01fad8 100644 --- a/Assets/Scripts/Unit/Component/PCState.cs +++ b/Assets/Scripts/Unit/Component/PCState.cs @@ -132,21 +132,21 @@ public class PCState : UnitState 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.pcAnimation.AnimIdle();
while (true)
{
- //if (Input.GetKeyDown("j"))
- //{
- // ChangeState(EUnitState.Attack, new SkillParam());
- //}
- if (Input.GetKeyDown("space"))
+ if (Input.GetKeyDown("j"))
+ {
+ ChangeState(EUnitState.Attack, new SkillParam());
+ }
+ if (Input.GetKeyDown("space"))
{
ChangeState(EUnitState.Jump, new JumpParam());
}
@@ -166,7 +166,7 @@ public class PCState : UnitState }
yield return null;
}
- }
+ //}
}
void OnIdleExit(EUnitState nextState)
@@ -202,23 +202,50 @@ public class PCState : UnitState m_Owner.pcAnimation.animator.ResetTrigger("ToMove");
}
- #endregion
-
- #region Attack
-
- IEnumerator Attack(SkillParam param)
- {
- while (true)
- {
-
-
- yield return null;
- }
- }
+ #endregion
+
+ #region Attack
+
+ IEnumerator Attack(SkillParam param)
+ {
+ const int total = 3;
+ int id = 0;
+ m_Owner.pcAnimation.AnimAttack(id);
+ yield return null;
+ while (true)
+ {
+ bool canCombo = m_Owner.pcAnimation.layers[0].IsToggleOpen(EAnimationToogle.Combo);
+ if (canCombo)
+ {
+ if (Input.GetKeyDown("j"))
+ {
+ if (Input.GetKey("a"))
+ {
+ TurnAround(false);
+ }
+ if (Input.GetKey("d"))
+ {
+ TurnAround(true);
+ }
+ ++id;
+ m_Owner.pcAnimation.AnimAttack(id);
+ yield return null; // 等待animator更新
+ yield return new WaitForTransitionDone(m_Owner.pcAnimation);
+ }
+ }
+
+ bool reachEnd = m_Owner.pcAnimation.layers[0].playbackNomralizedTime == 1;
+ if (reachEnd)
+ {
+ ChangeState(EUnitState.Idle, new IdleParam());
+ }
+
+ yield return null;
+ }
+ }
void OnAttackExit(EUnitState next)
{
-
}
#endregion
|