summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Avatar
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-11-16 14:38:55 +0800
committerchai <chaifix@163.com>2020-11-16 14:38:55 +0800
commitac2b469bd76d7d91d10894184cbddad0796ce7bc (patch)
treecd17f7c3820d1ecd8dd5919292784a819d9c925e /Assets/Scripts/Avatar
parent6a9c951e2ccbf768c87ed4226565a7117c8e2747 (diff)
*statecontroller
Diffstat (limited to 'Assets/Scripts/Avatar')
-rw-r--r--Assets/Scripts/Avatar/Actions/ActionJump.cs2
-rw-r--r--Assets/Scripts/Avatar/Actions/ActionJumpForward.cs2
-rw-r--r--Assets/Scripts/Avatar/Actions/ActionSwitchAbility.cs8
-rw-r--r--Assets/Scripts/Avatar/Avatar.cs12
-rw-r--r--Assets/Scripts/Avatar/Avatar_Hurt.cs12
-rw-r--r--Assets/Scripts/Avatar/StateSystem.cs4
6 files changed, 20 insertions, 20 deletions
diff --git a/Assets/Scripts/Avatar/Actions/ActionJump.cs b/Assets/Scripts/Avatar/Actions/ActionJump.cs
index b281a7b3..364dd7de 100644
--- a/Assets/Scripts/Avatar/Actions/ActionJump.cs
+++ b/Assets/Scripts/Avatar/Actions/ActionJump.cs
@@ -7,7 +7,7 @@ public class ActionJump : ActionSwitchState
{
private JumpState m_JumpState;
- public ActionJump(StateSystem system, JumpState jumpState)
+ public ActionJump(StateController system, JumpState jumpState)
: base(system, jumpState)
{
m_JumpState = jumpState;
diff --git a/Assets/Scripts/Avatar/Actions/ActionJumpForward.cs b/Assets/Scripts/Avatar/Actions/ActionJumpForward.cs
index d130411f..2fb28dc4 100644
--- a/Assets/Scripts/Avatar/Actions/ActionJumpForward.cs
+++ b/Assets/Scripts/Avatar/Actions/ActionJumpForward.cs
@@ -7,7 +7,7 @@ public class ActionJumpForward : ActionSwitchState
{
private JumpState m_JumpState;
- public ActionJumpForward(StateSystem system, JumpState jumpState)
+ public ActionJumpForward(StateController system, JumpState jumpState)
: base(system, jumpState)
{
m_JumpState = jumpState;
diff --git a/Assets/Scripts/Avatar/Actions/ActionSwitchAbility.cs b/Assets/Scripts/Avatar/Actions/ActionSwitchAbility.cs
index 89327951..caa927c8 100644
--- a/Assets/Scripts/Avatar/Actions/ActionSwitchAbility.cs
+++ b/Assets/Scripts/Avatar/Actions/ActionSwitchAbility.cs
@@ -5,17 +5,17 @@ using UnityEngine;
// 基础的切换 state
public class ActionSwitchState : ActionBase
{
- StateSystem m_StateSystem;
+ StateController m_StateController;
StateBase m_TargetState;
- public ActionSwitchState(StateSystem stateSystem, StateBase targetState)
+ public ActionSwitchState(StateController stateSystem, StateBase targetState)
{
- m_StateSystem = stateSystem;
+ m_StateController = stateSystem;
m_TargetState = targetState;
}
public override void Execute()
{
- m_StateSystem.SwitchToState(m_TargetState);
+ m_StateController.SwitchToState(m_TargetState);
}
}
diff --git a/Assets/Scripts/Avatar/Avatar.cs b/Assets/Scripts/Avatar/Avatar.cs
index 601fafab..0ee7555f 100644
--- a/Assets/Scripts/Avatar/Avatar.cs
+++ b/Assets/Scripts/Avatar/Avatar.cs
@@ -16,7 +16,7 @@ public partial class Avatar : MonoBehaviour, IInteractable
public Hitbox[] m_Hitbox;
public Hurtbox[] m_Hurtbox;
- protected StateSystem m_StateSystem = new StateSystem();
+ protected StateController m_StateController = new StateController();
// 预定义的state,角色必须定义的
protected StateBase m_StateLightHurt;
@@ -84,13 +84,13 @@ public partial class Avatar : MonoBehaviour, IInteractable
public void OnUpdate()
{
- m_StateSystem.OnUpdate();
+ m_StateController.OnUpdate();
}
// 在物理模拟之后调用
public void OnPhysicsUpdate()
{
- m_StateSystem.OnPhysicsUpdate();
+ m_StateController.OnPhysicsUpdate();
}
public virtual Vector3 GetEffectPosition()
@@ -101,13 +101,13 @@ public partial class Avatar : MonoBehaviour, IInteractable
// 获得当前击打如果有的话
public Hit GetHit()
{
- return m_StateSystem.GetHit();
+ return m_StateController.GetHit();
}
public virtual void OnHit(HitInfo hitInfo)
{
//Debug.Log("Hit");
- m_StateSystem.OnHit(hitInfo);
+ m_StateController.OnHit(hitInfo);
}
public virtual void OnHurt(HurtInfo hurtInfo)
@@ -116,7 +116,7 @@ public partial class Avatar : MonoBehaviour, IInteractable
HitDefination hitDef = hurtInfo.hitDef;
if (hitDef != null)
ApplyHit(hitDef);
- m_StateSystem.OnHurt(hurtInfo);
+ m_StateController.OnHurt(hurtInfo);
}
diff --git a/Assets/Scripts/Avatar/Avatar_Hurt.cs b/Assets/Scripts/Avatar/Avatar_Hurt.cs
index f82ffbb6..eebc9a78 100644
--- a/Assets/Scripts/Avatar/Avatar_Hurt.cs
+++ b/Assets/Scripts/Avatar/Avatar_Hurt.cs
@@ -14,13 +14,13 @@ public partial class Avatar : MonoBehaviour, IInteractable
// 切换到受击状态
switch(hit.type)
{
- case HitType.Light: m_StateSystem.SwitchToState(m_StateLightHurt); break;
- case HitType.Midium: m_StateSystem.SwitchToState(m_StateMidiumHurt); break;
- case HitType.Heavy: m_StateSystem.SwitchToState(m_StateHeavyHurt); break;
- case HitType.Ground: m_StateSystem.SwitchToState(m_StateGroundHurt); break;
- case HitType.Air: m_StateSystem.SwitchToState(m_StateAirHurt); break;
+ case HitType.Light: m_StateController.SwitchToState(m_StateLightHurt); break;
+ case HitType.Midium: m_StateController.SwitchToState(m_StateMidiumHurt); break;
+ case HitType.Heavy: m_StateController.SwitchToState(m_StateHeavyHurt); break;
+ case HitType.Ground: m_StateController.SwitchToState(m_StateGroundHurt); break;
+ case HitType.Air: m_StateController.SwitchToState(m_StateAirHurt); break;
default:
- m_StateSystem.SwitchToState(m_StateLightHurt);
+ m_StateController.SwitchToState(m_StateLightHurt);
break;
}
diff --git a/Assets/Scripts/Avatar/StateSystem.cs b/Assets/Scripts/Avatar/StateSystem.cs
index 42e35445..12ba6fe4 100644
--- a/Assets/Scripts/Avatar/StateSystem.cs
+++ b/Assets/Scripts/Avatar/StateSystem.cs
@@ -5,7 +5,7 @@ using UnityEngine;
/// <summary>
/// 每个角色拥有一个state system
/// </summary>
-public class StateSystem
+public class StateController
{
/// <summary>
/// 当前执行的state
@@ -24,7 +24,7 @@ public class StateSystem
private UberState m_UberState;
- public StateSystem()
+ public StateController()
{
}