diff options
Diffstat (limited to 'Assets/Scripts/Unit/Components')
4 files changed, 77 insertions, 19 deletions
diff --git a/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs b/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs index 8d737277..ac2649b7 100644 --- a/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs +++ b/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs @@ -46,17 +46,19 @@ public class PCAnimation : UnitAnimation Turn, Landing, - AirAttack0, - AirAttack1, - AirAttack2, - AirAttack3, - Attack0, Attack1, Attack2, - Attack3, - - AirDash, + Attack3,
+
+ AttackToAir,
+
+ AirAttack0, + AirAttack1, + AirAttack2, + AirAttack3,
+
+ AirDash, LandingGround, } @@ -174,7 +176,14 @@ public class PCAnimation : UnitAnimation } } - public void AnimAttack(int id) + public void AnimAttackToAir(float offset)
+ {
+ m_Owner.unitCollider.OnAnimationChange();
+ Play(EAnimState.AttackToAir, offset);
+ } +
+
+ public void AnimAttack(int id) { m_Owner.unitCollider.OnAnimationChange(); switch (id) @@ -216,7 +225,7 @@ public class PCAnimation : UnitAnimation CrossFade(EAnimState.LandingGround, 0.00f); } - private void Play(EAnimState animState, int layerIndex = 0, float normalizedTime = float.NegativeInfinity) + private void Play(EAnimState animState, float normalizedTime = float.NegativeInfinity, int layerIndex = 0) { base.Play(animState.ToString(), layerIndex, normalizedTime); } diff --git a/Assets/Scripts/Unit/Components/UnitCollider.cs b/Assets/Scripts/Unit/Components/UnitCollider.cs index 797eb480..3fd9a6dc 100644 --- a/Assets/Scripts/Unit/Components/UnitCollider.cs +++ b/Assets/Scripts/Unit/Components/UnitCollider.cs @@ -102,7 +102,7 @@ public class UnitCollider : UnitComponent var box = boxes[i]; if (!box.isValid) continue; - Vector3 localPos = box.position; + Vector3 localPos = m_Owner.transform.rotation * box.position; Vector3 localSize = box.size; var pivot = box.pivot; Vector3 pos = Vector3.zero; // gizmo位置 diff --git a/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs b/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs index 1dba2b7d..db68493b 100644 --- a/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs +++ b/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs @@ -132,6 +132,7 @@ public class MonsterState : UnitState IEnumerator HitAir(HitAirParam param) { + ((MonsterController)owner).FacePC(); m_Owner.monsterAnimation.AnimHitAir(); yield return null; while (true) diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState.cs b/Assets/Scripts/Unit/Components/UnitState/PCState.cs index e448b6b2..c8937895 100644 --- a/Assets/Scripts/Unit/Components/UnitState/PCState.cs +++ b/Assets/Scripts/Unit/Components/UnitState/PCState.cs @@ -20,6 +20,7 @@ public class PCState : UnitState // Attack, AirAttack, + AttackToAir, AirDash, // HitAir, @@ -66,7 +67,7 @@ public class PCState : UnitState public struct SkillParam { - + public float offset; } public struct AirDashParam @@ -153,7 +154,11 @@ public class PCState : UnitState { ChangeState(EUnitState.Attack, new SkillParam()); } - if (Input.GetKeyDown("space")) + if(Input.GetKeyDown("u"))
+ {
+ ChangeState(EUnitState.AttackToAir, new SkillParam());
+ }
+ if (Input.GetKeyDown("space")) { ChangeState(EUnitState.Jump, new JumpParam()); } @@ -221,8 +226,19 @@ public class PCState : UnitState yield return null; while (true) { - bool canCombo = m_Owner.pcAnimation.baseLayer.IsToggleOpen(EAnimationToogle.Combo); - if (canCombo && id < total) + bool canCombo = m_Owner.pcAnimation.baseLayer.IsToggleOpen(EAnimationToogle.Combo);
+ if (canCombo)
+ {
+ //if (InputManager.Instance.TryCommand(0.5f, KeyCode.W, KeyCode.J))
+ if (Input.GetKeyDown("u")) + {
+ SkillParam skill = new SkillParam();
+ skill.offset = 0.12f;
+ ChangeState(EUnitState.AttackToAir, skill);
+ }
+ }
+
+ if (canCombo && id < total) { if (Input.GetKeyDown("j")) { @@ -252,12 +268,44 @@ public class PCState : UnitState void OnAttackExit(EUnitState next) { - } - + }
+
#endregion - +
+ #region AttackToAir +
+ IEnumerator AttackToAir(SkillParam param)
+ {
+ m_Owner.pcAnimation.AnimAttackToAir(param.offset);
+ yield return null; + while (true)
+ {
+ bool canCombo = m_Owner.pcAnimation.baseLayer.IsToggleOpen(EAnimationToogle.Combo);
+ if(canCombo)
+ {
+ if(Input.GetKeyDown("j"))
+ {
+ ChangeState(EUnitState.AirAttack, new SkillParam());
+ }
+ }
+
+ bool reachEnd = m_Owner.pcAnimation.baseLayer.playbackNormalizedTime == 1; + if (reachEnd) + { + ChangeState(EUnitState.Landing, new LandingParam()); + }
+ yield return null;
+ }
+ }
+
+ void OnAttackToAirExit()
+ {
+ }
+
+ #endregion +
#region AirAttack - +
IEnumerator AirAttack(SkillParam param) { int id = 0; |