diff options
| author | chai <chaifix@163.com> | 2020-11-16 08:30:54 +0800 |
|---|---|---|
| committer | chai <chaifix@163.com> | 2020-11-16 08:30:54 +0800 |
| commit | f325841eff10ae492ce6c634d4b07cf058a068c6 (patch) | |
| tree | 980d81a4b87d571fcb893fc44f8809af97466bca /Assets/Scripts/Avatar/AbilitySystem.cs | |
| parent | be3ca8b172f22ce7c4c4316745e0df05de58b069 (diff) | |
*state system
Diffstat (limited to 'Assets/Scripts/Avatar/AbilitySystem.cs')
| -rw-r--r-- | Assets/Scripts/Avatar/AbilitySystem.cs | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/Assets/Scripts/Avatar/AbilitySystem.cs b/Assets/Scripts/Avatar/AbilitySystem.cs deleted file mode 100644 index 5f6e9364..00000000 --- a/Assets/Scripts/Avatar/AbilitySystem.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -/// <summary> -/// 每个角色拥有一个ablity system -/// </summary> -public class AbilitySystem -{ - /// <summary> - /// 当前执行的ability - /// </summary> - private AbilityBase m_Currrent; - - public AbilityBase Current - { - get - { - return m_Currrent; - } - } - - private List<AbilityBase> m_Abilities = new List<AbilityBase>(); - - private UberAbility m_UberAbility; - - public AbilitySystem() - { - } - - public void ForceStart(AbilityBase ability) - { - if (ability == null) - return; - - if (m_Currrent != null) - m_Currrent.OnExit(); - - m_Currrent = ability; - m_Currrent.OnEnter(); - } - - public void SetUberAbility(UberAbility ability)
- {
- m_UberAbility = ability;
- } - - public void AddAbility(AbilityBase ability) - { - m_Abilities.Add(ability); - } - - public void OnUpdate() - { - if(m_Currrent != null) - { - m_Currrent.OnUpdate(); - } - if(m_UberAbility != null)
- {
- m_UberAbility.OnUpdate(); - }
- } - - public void OnPhysicsUpdate() - { - if(m_Currrent != null) - { - m_Currrent.OnPhysicsUpdate(); - } - if(m_UberAbility != null)
- {
- m_UberAbility.OnPhysicsUpdate(); - }
- }
-
- public void OnHit(HitInfo info)
- {
- if (m_Currrent != null)
- m_Currrent.OnHit(info);
- } - - public void OnHurt(HurtInfo info)
- {
- if (m_Currrent != null)
- m_Currrent.OnHurt(info); - } -
- public void SwitchToAbility(AbilityBase targetAbility) - { - if (m_Currrent != null) - m_Currrent.OnExit(); - m_Currrent = targetAbility; - m_Currrent.OnEnter(); - } - - // 获得当前击打如果有的话
- public Hit GetHit()
- {
- if (Current == null || !(Current is AttackAbility))
- return null;
- AttackAbility ability = Current as AttackAbility;
- return ability.GetHit();
- } - -}
\ No newline at end of file |
