summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Unit/Components/UnitState
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2022-03-10 14:07:40 +0800
committerchai <chaifix@163.com>2022-03-10 14:07:40 +0800
commit22891bf59032ba88262824255a706d652031384b (patch)
tree7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/Scripts/Unit/Components/UnitState
parent8b04ea73e540067f83870b61d89db4868fea5e8a (diff)
* move folder
Diffstat (limited to 'Assets/Scripts/Unit/Components/UnitState')
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/DroneState.cs18
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/DroneState.cs.meta11
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/MonsterState.cs218
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/MonsterState.cs.meta11
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/PCState.cs186
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/PCState.cs.meta11
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs24
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs.meta11
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/PCState_States.cs390
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/PCState_States.cs.meta11
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/PropState.cs18
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/PropState.cs.meta11
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/RobotState.cs18
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/RobotState.cs.meta11
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/UnitState.cs40
-rw-r--r--Assets/Scripts/Unit/Components/UnitState/UnitState.cs.meta11
16 files changed, 0 insertions, 1000 deletions
diff --git a/Assets/Scripts/Unit/Components/UnitState/DroneState.cs b/Assets/Scripts/Unit/Components/UnitState/DroneState.cs
deleted file mode 100644
index 28640664..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/DroneState.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class DroneState : MonoBehaviour
-{
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
-}
diff --git a/Assets/Scripts/Unit/Components/UnitState/DroneState.cs.meta b/Assets/Scripts/Unit/Components/UnitState/DroneState.cs.meta
deleted file mode 100644
index ab3a2898..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/DroneState.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: a6917bf61e4a31945846081533eb02f4
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs b/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs
deleted file mode 100644
index c2a581b1..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs
+++ /dev/null
@@ -1,218 +0,0 @@
-using System;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class MonsterState : UnitState
-{
- public enum EUnitState
- {
- Nien,
-
- Idle,
-
- Move,
-
- HitLight,
- HitAir,
- HitInAir,
- HitGround,
- HitFall,
- KnockDown,
- Rise,
-
- Pull,
- Landing,
- }
-
- [SerializeField] private EUnitState m_State;
- public EUnitState CurrentState { get { return m_State; } }
-
- UnitAnimation unitAnimation { get { return m_Owner.unitAnimation; } }
-
- public override void Initialize()
- {
- base.Initialize();
- }
-
- public void ChangeState<T>(EUnitState nextState, T param = default, bool bForce = false)
- {
- if (!IsChange(nextState, bForce))
- return;
-
- LogHelper.Log("Monster UnitState: " + m_State.ToString() + " -> " + nextState.ToString());
-
- StopAllCoroutines();
-
- EUnitState prevState = m_State;
- string methodFunc = "On" + m_State.ToString() + "Exit";
- MethodInfo exitMethod = GetType().GetMethod(methodFunc, BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[] { typeof(EUnitState) }, null);
- if (exitMethod != null)
- {
- exitMethod.Invoke(this, new object[] { nextState });
- }
- else
- {
- LogHelper.LogError("缺少 " + methodFunc);
- }
- m_State = nextState;
-
- StartCoroutine(m_State.ToString(), param);
- }
-
- bool IsChange(EUnitState newState, bool bForce)
- {
- if (newState != m_State || bForce)
- return true;
- return false;
- }
-
- IEnumerator Nein() { yield break; }
- void OnNienExit(EUnitState nextState) { }
-
- public struct IdleParam { }
-
- public struct LandingParam { }
-
- public struct HitLightParam { }
-
- public struct HitAirParam { }
-
- public struct RiseParam { }
-
- public struct HitInAirParam { }
-
- #region Idle
-
- IEnumerator Idle(IdleParam param)
- {
- //if (m_Owner.isInAir) // 浮空切换到landing
- //{
- // ChangeState(EUnitState.Landing, new LandingParam());
- //}
- //else // idle
- //{
- m_Owner.SetYPosition(0);
- m_Owner.monsterAnimation.AnimIdle();
- while (true)
- {
- yield return null;
- }
- //}
- }
-
- void OnIdleExit(EUnitState nextState)
- {
- }
- #endregion
-
- #region HitLight
-
- IEnumerator HitLight(HitLightParam param)
- {
- ((MonsterController)owner).FacePC();
- m_Owner.monsterAnimation.AnimHitBackHeavy();
- yield return null;
- while (true)
- {
- bool reachEnd = m_Owner.monsterAnimation.layers[0].playbackNormalizedTime == 1;
- if(reachEnd)
- {
- ChangeState(EUnitState.Idle, new IdleParam());
- }
- yield return null;
- }
- }
-
- void OnHitLightExit(EUnitState nextState)
- {
- }
-
- #endregion
-
- #region HitAir
-
- IEnumerator HitAir(HitAirParam param)
- {
- ((MonsterController)owner).FacePC();
- m_Owner.monsterAnimation.AnimHitAir();
- yield return null;
- while (true)
- {
- bool reachEnd = m_Owner.monsterAnimation.layers[0].playbackNormalizedTime == 1;
- if (reachEnd)
- {
- //yield return new WaitForSeconds(1f);
- ChangeState(EUnitState.Rise, new RiseParam());
- }
- yield return null;
- }
- }
-
- void OnHitAirExit(EUnitState nextState)
- {
- }
-
- #endregion
-
- #region HitInAir
-
- IEnumerator HitInAir(HitInAirParam param)
- {
- ((MonsterController)owner).FaceToFacePC();
- m_Owner.monsterAnimation.AnimHitInAir();
- yield return null;
- float vy = -1f;
- float g = -15.8f;
- while (true)
- {
- bool reachEnd = m_Owner.monsterAnimation.baseLayer.playbackNormalizedTime == 1;
- if (reachEnd)
- {
- vy += g * Time.deltaTime;
- Vector3 pos = owner.transform.position;
- pos.y += vy * Time.deltaTime;
- if(pos.y <= 0)
- {
- yield return new WaitForSeconds(0.5f);
- ChangeState(EUnitState.Rise, new RiseParam());
- }
- owner.transform.position = pos;
- }
- yield return null;
- }
- }
-
- void OnHitInAirExit(EUnitState nextState)
- {
- }
-
- #endregion
-
- #region Rise
-
- IEnumerator Rise(RiseParam param)
- {
- m_Owner.monsterAnimation.AnimRise();
- yield return null;
- while (true)
- {
- bool reachEnd = m_Owner.monsterAnimation.layers[0].playbackNormalizedTime == 1;
- if (reachEnd)
- {
- ChangeState(EUnitState.Idle, new IdleParam());
- }
- yield return null;
- }
- }
-
- void OnRiseExit(EUnitState nextState)
- {
- }
-
-
- #endregion
-
-
-} \ No newline at end of file
diff --git a/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs.meta b/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs.meta
deleted file mode 100644
index 7d60499f..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: b7b1805198282374fbc67108671f8a72
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState.cs b/Assets/Scripts/Unit/Components/UnitState/PCState.cs
deleted file mode 100644
index 6a326431..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/PCState.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-using System;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// 角色状态机
-[DisallowMultipleComponent]
-public partial class PCState : UnitState
-{
- public enum EUnitState
- {
- Nien,
-
- Idle,
- Move,
- Spawn,
- Die,
- Dead,
- //
- Attack,
- AirAttack,
- AttackToAir,
- AirDash,
- //
- HitAir,
- HitAirHit,
- Knockdown,
- //
- HitGuard,
- //
- Walk,
- //
- Rise,
- //
- Jump,
- // 转身
- Turn,
- Landing, // 从空中降落
- }
-
- [SerializeField] private EUnitState m_State;
- public EUnitState CurrentState { get { return m_State; } }
-
- private EUnitState m_PrevState;
-
- public override void Initialize()
- {
- base.Initialize();
- owner.onTimelineEvent += OnTimeLineEvent;
- }
-
- public override void Release()
- {
- owner.onTimelineEvent -= OnTimeLineEvent;
- base.Release();
- }
-
- PCAnimation pcAnimation { get { return m_Owner.pcAnimation; } }
-
- public void ChangeState<T>(EUnitState nextState, T param = default, bool bForce = false)
- {
- if (!IsChange(nextState, bForce))
- return;
-
- LogHelper.Log("UnitState: " + m_State.ToString() + " -> " + nextState.ToString());
-
- StopAllCoroutines();
-
- string methodFunc = "On" + m_State.ToString() + "Exit";
- MethodInfo exitMethod = GetType().GetMethod(methodFunc, BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[] { typeof(EUnitState) }, null);
- if (exitMethod != null)
- {
- exitMethod.Invoke(this, new object[] { nextState });
- }
- else
- {
- LogHelper.LogError("缺少 " + methodFunc);
- }
- m_PrevState = m_State;
- m_State = nextState;
-
- if(m_PrevState != m_State && owner.unitRender != null)
- {
- // owner.unitRender.SetVisibilityInMainCamera(true);
- }
-
- StartCoroutine(m_State.ToString(), param);
- }
-
- bool IsChange(EUnitState newState, bool bForce)
- {
- if (newState != m_State || bForce)
- return true;
- return false;
- }
-
- public void TurnAround(bool bRight)
- {
- m_Owner.transform.rotation = Quaternion.Euler(0, bRight ? 0 : 180, 0);
- }
-
- public void TurnLeft()
- {
- TurnAround(false);
- }
-
- public void TurnRight()
- {
- TurnAround(true);
- }
-
- void TryDash()
- {
- if (InputManager.Instance.TryCommand(0.5f, KeyCode.A, KeyCode.A))
- {
- TurnLeft();
- ChangeState(EUnitState.AirDash, new AirDashParam(), true);
- }
- if (InputManager.Instance.TryCommand(0.5f, KeyCode.D, KeyCode.D))
- {
- TurnRight();
- ChangeState(EUnitState.AirDash, new AirDashParam(), true);
- }
- }
-
- void TryTurnAround()
- {
- if (Input.GetKey("a"))
- {
- TurnLeft();
- }
- if (Input.GetKey("d"))
- {
- TurnRight();
- }
- }
-
- bool TryTeleport()
- {
- if (Input.GetKeyDown("i"))
- {
- float offset = owner.isTowardRight ? 1.5f : -1.5f;
-
- Vector3 targetPos = TestErika.Instance.monster.owner.center + new Vector3(offset, -0.5f, 0);
- targetPos.y = Mathf.Max(1, targetPos.y);
-
- UnitSnapshotInfo info = owner.TakeSnapshot();
- Vector2 dir = targetPos - owner.center;
- owner.unitLensEffect.Dash(Color.white, 0.1f, Mathf.Rad2Deg * Mathf.Atan2(dir.y, dir.x), info);
-
- owner.center = targetPos;
- TurnAround(!owner.isTowardRight);
- return true;
- }
- return false;
- }
-
- bool TryBlink()
- {
- return false;
- }
-
- 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("w") && 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.cs.meta b/Assets/Scripts/Unit/Components/UnitState/PCState.cs.meta
deleted file mode 100644
index 548a0a91..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/PCState.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 9a888cbca17562d4dbea1f28fd4dcbab
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs b/Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs
deleted file mode 100644
index 73c65a0c..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public partial class PCState : UnitState
-{
-
-
- void OnTimeLineEvent(AnimationEventBase animEvent)
- {
- if(animEvent is EventUnit_SetPosition)
- {
- EventUnit_SetPosition setPos = animEvent as EventUnit_SetPosition;
- Vector3 pos = owner.transform.position;
- if(setPos.setY)
- {
- pos.y = setPos.y;
- }
- owner.transform.position = pos;
- }
-
- }
-
-}
diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs.meta b/Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs.meta
deleted file mode 100644
index 7dc2d927..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 760f104e062ae884d809b7fc80b041b4
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs b/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs
deleted file mode 100644
index 738cc7ce..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs
+++ /dev/null
@@ -1,390 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public partial class PCState : UnitState
-{
-
- #region state param
- public struct IdleParam { }
-
- public struct MoveParam
- {
- public bool isRight;
- public string key;
- }
-
- public struct SkillParam
- {
- public float offset;
- }
-
- public struct AirDashParam
- {
-
- }
-
- public struct JumpParam
- { }
-
- public struct TurnParam
- {
- EUnitState nextState;
- }
-
- public struct LandingParam { }
-
- #endregion
-
- IEnumerator Nein() { yield break; }
- void OnNienExit(EUnitState nextState) { }
-
- #region Idle
-
- IEnumerator Idle(IdleParam param)
- {
- m_Owner.pcAnimation.AnimIdle();
- yield return new WaitForTransitionDone(owner.unitAnimation);
- m_Owner.SetYPosition(0);
- while (true)
- {
- if(TryAttackToAir())
- {
- yield break;
- }
- if (Input.GetKeyDown("j"))
- {
- ChangeState(EUnitState.Attack, new SkillParam());
- yield break;
- }
- if (Input.GetKeyDown("space"))
- {
- ChangeState(EUnitState.Jump, new JumpParam());
- yield break;
- }
- if (Input.GetKey("d"))
- {
- MoveParam move = new MoveParam();
- move.isRight = true;
- move.key = "d";
- ChangeState(EUnitState.Move, move);
- yield break;
- }
- if (Input.GetKey("a"))
- {
- MoveParam move = new MoveParam();
- move.isRight = false;
- move.key = "a";
- ChangeState(EUnitState.Move, move);
- yield break;
- }
- yield return null;
- }
- }
-
- void OnIdleExit(EUnitState nextState)
- {
- }
- #endregion
-
- #region Move
- IEnumerator Move(MoveParam param)
- {
- if (m_Owner.isTowardRight && !param.isRight
- || !m_Owner.isTowardRight && param.isRight)
- {
- //m_Owner.pcAnimation.Play(UnitAnimation.EAnimState.Turn);
- //yield return new WaitForActionReachEnd(m_Owner.pcAnimation);
- //if (param.isRight)
- // m_Owner.transform.rotation = Quaternion.Euler(0, 0, 0);
- //else
- // m_Owner.transform.rotation = Quaternion.Euler(0, 180, 0);
- m_Owner.transform.rotation = Quaternion.Euler(0, param.isRight ? 0 : 180, 0);
- }
- //if (Input.GetKey(param.key))
- m_Owner.pcAnimation.AnimMove();
- while (Input.GetKey(param.key))
- {
- TryAttackToAir();
- yield return null;
- }
- ChangeState(EUnitState.Idle, new IdleParam());
- }
-
- void OnMoveExit(EUnitState nextState)
- {
- m_Owner.pcAnimation.animator.ResetTrigger("ToMove");
- }
-
- #endregion
-
- #region Attack
-
- IEnumerator Attack(SkillParam param)
- {
- const int total = 4;
- int id = 0;
- m_Owner.pcAnimation.AnimAttack(id++);
- yield return null;
- while (true)
- {
- if (isComboOpen)
- {
- //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 (isComboOpen && id < total)
- {
- if (Input.GetKeyDown("j"))
- {
- TryTurnAround();
-
- m_Owner.pcAnimation.AnimAttack(id++);
- yield return null;
- yield return new WaitForTransitionDone(m_Owner.pcAnimation);
- }
- }
-
- if (isAnimationReachEnd)
- {
- ChangeState(EUnitState.Idle, new IdleParam());
- }
-
- yield return null;
- }
- }
-
- void OnAttackExit(EUnitState next)
- {
- }
-
- #endregion
-
- #region AttackToAir
-
- IEnumerator AttackToAir(SkillParam param)
- {
- m_Owner.pcAnimation.AnimAttackToAir(param.offset);
- yield return null;
- InputManager.Instance.ClearCommand();
- while (true)
- {
- TryTianyin();
-
- if (isComboOpen)
- {
- TryDash();
-
- if (InputManager.Instance.TryCommand(0.5f, false, KeyCode.J))
- {
- ChangeState(EUnitState.AirAttack, new SkillParam());
- }
- }
-
- if (isAnimationReachEnd || isAnimationReachEndPoint)
- {
- ChangeState(EUnitState.Landing, new LandingParam());
- }
- yield return null;
- }
- }
-
- void OnAttackToAirExit(EUnitState next)
- {
- }
-
- #endregion
-
- #region AirAttack
-
- IEnumerator AirAttack(SkillParam param)
- {
- int total = 5;
- int id = 0;
- m_Owner.pcAnimation.AnimAirAttack(id++);
- yield return null;
- InputManager.Instance.ClearCommand();
- while (true)
- {
- if (TryTeleport())
- {
- }
-
- TryTianyin();
-
- if (isComboOpen)
- {
- TryDash();
-
- if (InputManager.Instance.TryCommand(0.3f, false, KeyCode.J))
- {
- TryTurnAround();
-
- m_Owner.pcAnimation.AnimAirAttack(id++);
- id %= total;
- yield return null; // 等待animator更新
- yield return new WaitForTransitionDone(m_Owner.pcAnimation);
- }
- }
-
- if (isAnimationReachEnd)
- {
- ChangeState(EUnitState.Landing, new LandingParam());
- }
-
- yield return null;
- }
- }
-
- void OnAirAttackExit(EUnitState next)
- {
-
- }
-
- #endregion
-
- #region AirDash
-
- IEnumerator AirDash(AirDashParam param)
- {
- m_Owner.pcAnimation.AnimAirDash();
- yield return null;
- while (true)
- {
- if (isAnimationReachEnd)
- {
- ChangeState(EUnitState.Landing, new LandingParam());
- }
-
- TryTianyin();
-
- if (isComboOpen)
- {
- TryDash();
-
- if (Input.GetKeyDown("j"))
- {
- TryTurnAround();
- ChangeState(EUnitState.AirAttack, new SkillParam());
- }
- }
-
- yield return null;
- }
- }
-
- void OnAirDashExit(EUnitState next)
- {
- }
-
- #endregion
-
- #region Jump
-
- IEnumerator Jump(JumpParam param)
- {
- pcAnimation.AnimJump();
- yield return null;
- yield return new WaitForTransitionDone(pcAnimation);
- while (true)
- {
- if (InputManager.Instance.TryCommand(0.5f, KeyCode.A, KeyCode.A))
- {
- TurnLeft();
- ChangeState(EUnitState.AirDash, new AirDashParam());
- }
- if (InputManager.Instance.TryCommand(0.5f, KeyCode.D, KeyCode.D))
- {
- TurnRight();
- ChangeState(EUnitState.AirDash, new AirDashParam());
- }
- if (isAnimationReachEnd)
- ChangeState(EUnitState.Landing, new LandingParam());
- bool canAttack = m_Owner.pcAnimation.baseLayer.IsToggleOpen(EAnimationToogle.Combo);
- if (Input.GetKeyDown("j") && canAttack)
- {
- ChangeState(EUnitState.AirAttack, new SkillParam());
- }
- yield return null;
- }
- }
-
- void OnJumpExit(EUnitState next)
- {
- }
-
- #endregion
-
- #region Landing
-
- IEnumerator Landing(LandingParam param)
- {
- m_Owner.pcAnimation.AnimLanding();
- yield return null;
- yield return new WaitForTransitionDone(m_Owner.pcAnimation);
- float vy = 0;
- float g = -9.8f;
- bool landingGround = false;
- float vx = 5;
- while (true)
- {
- Vector3 pos = m_Owner.transform.position;
-
- if(!landingGround)
- {
- vy += g * Time.deltaTime;
- pos.y += vy * Time.deltaTime;
- pos.y = Mathf.Max(0, pos.y);
- }
-
- TryDash();
-
- TryTianyin();
-
- if (Input.GetKey("a"))
- {
- TurnAround(false);
- pos.x -= vx * Time.deltaTime;
- }
- if (Input.GetKey("d"))
- {
- 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();
- }
- if (pos.y <= 0)
- {
- pos.y = 0;
- m_Owner.transform.position = pos;
- ChangeState(EUnitState.Idle, new IdleParam());
- }
-
- yield return null;
- }
- }
-
- void OnLandingExit(EUnitState next)
- {
- }
-
- #endregion
-
-}
diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs.meta b/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs.meta
deleted file mode 100644
index e314f21e..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: bfcb25f32c442a5429ab4d0603b9df67
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Scripts/Unit/Components/UnitState/PropState.cs b/Assets/Scripts/Unit/Components/UnitState/PropState.cs
deleted file mode 100644
index 86b95e38..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/PropState.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class PropState : MonoBehaviour
-{
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
-}
diff --git a/Assets/Scripts/Unit/Components/UnitState/PropState.cs.meta b/Assets/Scripts/Unit/Components/UnitState/PropState.cs.meta
deleted file mode 100644
index db5dd78f..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/PropState.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 96148351ded87a247bbdf39d56eb592e
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Scripts/Unit/Components/UnitState/RobotState.cs b/Assets/Scripts/Unit/Components/UnitState/RobotState.cs
deleted file mode 100644
index 68a11135..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/RobotState.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class RobotState : MonoBehaviour
-{
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
-}
diff --git a/Assets/Scripts/Unit/Components/UnitState/RobotState.cs.meta b/Assets/Scripts/Unit/Components/UnitState/RobotState.cs.meta
deleted file mode 100644
index ef3ef469..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/RobotState.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 12346a9b76519ab4098b11da90589040
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Scripts/Unit/Components/UnitState/UnitState.cs b/Assets/Scripts/Unit/Components/UnitState/UnitState.cs
deleted file mode 100644
index ff42c2be..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/UnitState.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// 角色状态机
-[DisallowMultipleComponent]
-public class UnitState : UnitComponent
-{
-
- public virtual bool isAnimationReachEnd
- {
- get
- {
- return owner.unitAnimation.baseLayer.playbackNormalizedTime == 1;
- }
- }
-
- // 如果设置了endpoint属性,检查是否到了endpoint
- public virtual bool isAnimationReachEndPoint
- {
- get
- {
- var layer = owner.unitAnimation.baseLayer;
- if (!layer.animationData.HasProperty(EAnimationProperty.Endpoint))
- return false;
- return layer.playbackNormalizedTime >= layer.animationData.GetProperty(EAnimationProperty.Endpoint);
- }
- }
-
- public virtual bool isComboOpen
- {
- get
- {
- return owner.unitAnimation.baseLayer.IsToggleOpen(EAnimationToogle.Combo);
- }
- }
-
-} \ No newline at end of file
diff --git a/Assets/Scripts/Unit/Components/UnitState/UnitState.cs.meta b/Assets/Scripts/Unit/Components/UnitState/UnitState.cs.meta
deleted file mode 100644
index 781994dc..00000000
--- a/Assets/Scripts/Unit/Components/UnitState/UnitState.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: e5c9c1db07e3c734ebf185f14cc7356a
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant: