summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/Unit/Components/UnitState/PCState_States.cs')
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/PCState_States.cs33
1 files changed, 19 insertions, 14 deletions
diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs b/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs
index 2cfaf876..14d62c87 100644
--- a/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs
+++ b/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs
@@ -43,14 +43,9 @@ public partial class PCState : UnitState
IEnumerator Idle(IdleParam param)
{
- //if (m_Owner.isInAir) // 浮空切换到landing
- //{
- // ChangeState(EUnitState.Landing, new LandingParam());
- //}
- //else // idle
- //{
- m_Owner.SetYPosition(0);
m_Owner.pcAnimation.AnimIdle();
+ yield return new WaitForTransitionDone(owner.unitAnimation);
+ m_Owner.SetYPosition(0);
while (true)
{
if (Input.GetKeyDown("j"))
@@ -81,7 +76,6 @@ public partial class PCState : UnitState
}
yield return null;
}
- //}
}
void OnIdleExit(EUnitState nextState)
@@ -106,7 +100,11 @@ public partial class PCState : UnitState
//if (Input.GetKey(param.key))
m_Owner.pcAnimation.AnimMove();
while (Input.GetKey(param.key))
- {
+ {
+ if (Input.GetKeyDown("u"))
+ {
+ ChangeState(EUnitState.AttackToAir, new SkillParam());
+ }
yield return null;
}
ChangeState(EUnitState.Idle, new IdleParam());
@@ -188,7 +186,7 @@ public partial class PCState : UnitState
}
}
- if (isAnimationReachEnd)
+ if (isAnimationReachEnd || isAnimationReachEndPoint)
{
ChangeState(EUnitState.Landing, new LandingParam());
}
@@ -334,9 +332,13 @@ public partial class PCState : UnitState
while (true)
{
Vector3 pos = m_Owner.transform.position;
- vy += g * Time.deltaTime;
- pos.y += vy * Time.deltaTime;
- pos.y = Mathf.Max(0, pos.y);
+
+ if(!landingGround)
+ {
+ vy += g * Time.deltaTime;
+ pos.y += vy * Time.deltaTime;
+ pos.y = Mathf.Max(0, pos.y);
+ }
TryDash();
@@ -352,13 +354,16 @@ public partial class PCState : UnitState
TurnAround(true);
pos.x += vx * Time.deltaTime;
}
+
if (Input.GetKeyDown("j"))
{
ChangeState(EUnitState.AirAttack, new SkillParam());
}
+
m_Owner.transform.position = pos;
+
if (pos.y > 0 && pos.y <= 1 && !landingGround)
- {
+ {
landingGround = true;
m_Owner.pcAnimation.AnimLandingGround();
}