summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Unit/Components/UnitState
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/Unit/Components/UnitState')
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/PCState.cs14
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/PCState_States.cs17
2 files changed, 22 insertions, 9 deletions
diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState.cs b/Assets/Scripts/Unit/Components/UnitState/PCState.cs
index 0880d369..afedf6d8 100644
--- a/Assets/Scripts/Unit/Components/UnitState/PCState.cs
+++ b/Assets/Scripts/Unit/Components/UnitState/PCState.cs
@@ -147,14 +147,26 @@ public partial class PCState : UnitState
}
- void TryTianyin()
+ bool TryTianyin()
{
if (Input.GetKeyDown("o"))
{
float offset = owner.isTowardRight ? 1.2f : -1.2f;
TestErika.Instance.monster.owner.center = owner.center + new Vector3(offset, 0.5f, 0);
((MonsterController)TestErika.Instance.monster.owner).monsterState.ChangeState(MonsterState.EUnitState.HitInAir, new MonsterState.HitInAirParam(), true);
+ return true;
}
+ return false;
+ }
+
+ bool TryAttackToAir()
+ {
+ if(Input.GetKey("s") && Input.GetKeyDown("j"))
+ {
+ ChangeState(EUnitState.AttackToAir, new SkillParam());
+ return true;
+ }
+ return false;
}
} \ No newline at end of file
diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs b/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs
index 512c2113..7860e2af 100644
--- a/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs
+++ b/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs
@@ -48,17 +48,19 @@ public partial class PCState : UnitState
m_Owner.SetYPosition(0);
while (true)
{
- if (Input.GetKeyDown("j"))
+ if(TryAttackToAir())
{
- ChangeState(EUnitState.Attack, new SkillParam());
+ yield break;
}
- if (Input.GetKeyDown("u"))
+ if (Input.GetKeyDown("j"))
{
- ChangeState(EUnitState.AttackToAir, new SkillParam());
+ ChangeState(EUnitState.Attack, new SkillParam());
+ yield break;
}
if (Input.GetKeyDown("space"))
{
ChangeState(EUnitState.Jump, new JumpParam());
+ yield break;
}
if (Input.GetKey("d"))
{
@@ -66,6 +68,7 @@ public partial class PCState : UnitState
move.isRight = true;
move.key = "d";
ChangeState(EUnitState.Move, move);
+ yield break;
}
if (Input.GetKey("a"))
{
@@ -73,6 +76,7 @@ public partial class PCState : UnitState
move.isRight = false;
move.key = "a";
ChangeState(EUnitState.Move, move);
+ yield break;
}
yield return null;
}
@@ -101,10 +105,7 @@ public partial class PCState : UnitState
m_Owner.pcAnimation.AnimMove();
while (Input.GetKey(param.key))
{
- if (Input.GetKeyDown("u"))
- {
- ChangeState(EUnitState.AttackToAir, new SkillParam());
- }
+ TryAttackToAir();
yield return null;
}
ChangeState(EUnitState.Idle, new IdleParam());