diff options
author | chai <chaifix@163.com> | 2021-08-06 19:02:03 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-08-06 19:02:03 +0800 |
commit | 754ceacd8ab62e7094f1827ae45ea16a502725ad (patch) | |
tree | 7165384f470bf0c4ae261d7dd22876416c150964 /Assets/Scripts/Unit/Component/UnitState.cs | |
parent | 35f2e468715e12d93cb88f2258c2d0ae82d1d189 (diff) |
*curve
Diffstat (limited to 'Assets/Scripts/Unit/Component/UnitState.cs')
-rw-r--r-- | Assets/Scripts/Unit/Component/UnitState.cs | 56 |
1 files changed, 46 insertions, 10 deletions
diff --git a/Assets/Scripts/Unit/Component/UnitState.cs b/Assets/Scripts/Unit/Component/UnitState.cs index 4a57ad6d..fd9bba00 100644 --- a/Assets/Scripts/Unit/Component/UnitState.cs +++ b/Assets/Scripts/Unit/Component/UnitState.cs @@ -10,7 +10,9 @@ public class UnitState : UnitComponent {
public enum EUnitState
{
- Idle ,
+ Nien,
+
+ Idle ,
Move ,
Spawn ,
Die ,
@@ -105,21 +107,47 @@ public class UnitState : UnitComponent return false;
}
- #region Idle
+ IEnumerator Nein() { yield break; }
+ void OnNienExit(EUnitState nextState) { }
+
+ #region Idle
IEnumerator Idle(IdleParam param)
{
- if(m_Owner.isInAir)
+ if(m_Owner.isInAir) // 浮空切换到landing
{
}
- m_Owner.unitAnimation.AnimIdle();
- yield return null;
+ else // idle
+ {
+ m_Owner.SetYPosition(0);
+ m_Owner.unitAnimation.AnimIdle();
+ while (true)
+ {
+ if (Input.GetKeyDown("j"))
+ {
+ ChangeState(EUnitState.Skill, new SkillParam());
+ }
+ if (Input.GetKeyDown("space"))
+ {
+ ChangeState(EUnitState.Jump, new JumpParam());
+ }
+ if (Input.GetKey("d"))
+ {
+ InputManager.Instance.OnMoveRight();
+ }
+ if (Input.GetKey("a"))
+ {
+ InputManager.Instance.OnMoveLeft();
+ }
+ yield return null;
+ }
+ }
}
void OnIdleExit(EUnitState nextState)
{
- LogHelper.Log(nextState.ToString());
+ m_Owner.unitAnimation.animator.ResetTrigger("ToIdle");
}
#endregion
@@ -139,7 +167,7 @@ public class UnitState : UnitComponent }
//if (Input.GetKey(param.key))
m_Owner.unitAnimation.AnimMove();
- while (Input.GetKey(param.key))
+ while (Input.GetKey(param.key))
{
yield return null;
}
@@ -148,7 +176,7 @@ public class UnitState : UnitComponent void OnMoveExit(EUnitState nextState)
{
- //m_Owner.unitAnimation.animator.ResetTrigger("ToMove");
+ m_Owner.unitAnimation.animator.ResetTrigger("ToMove");
}
#endregion
@@ -174,8 +202,16 @@ public class UnitState : UnitComponent IEnumerator Jump(JumpParam param)
{
- yield return new WaitForActionReachEnd(m_Owner.unitAnimation);
- ChangeState<IdleParam>(EUnitState.Idle);
+ while(true)
+ {
+ // 空中连击
+ if(Input.GetKeyDown("j"))
+ {
+ SkillParam skill = new SkillParam();
+ ChangeState(EUnitState.Skill, skill);
+ }
+ yield return null;
+ }
}
void OnJumpExit(EUnitState next)
|