diff options
author | chai <chaifix@163.com> | 2020-10-13 17:20:14 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-10-13 17:20:14 +0800 |
commit | 71c03c717b189ee0ff0e62d219f02b8ab336c40a (patch) | |
tree | 395ce6c55f1876ca6451c706e38a95d0bcbf70a6 /Assets/Scripts/AbilitySystem/Abilities/AbilityBase.cs | |
parent | fc6de82e75310b4c007d80753a5f58e6692f4855 (diff) |
+ability system
Diffstat (limited to 'Assets/Scripts/AbilitySystem/Abilities/AbilityBase.cs')
-rw-r--r-- | Assets/Scripts/AbilitySystem/Abilities/AbilityBase.cs | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Assets/Scripts/AbilitySystem/Abilities/AbilityBase.cs b/Assets/Scripts/AbilitySystem/Abilities/AbilityBase.cs new file mode 100644 index 00000000..330850e2 --- /dev/null +++ b/Assets/Scripts/AbilitySystem/Abilities/AbilityBase.cs @@ -0,0 +1,61 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 同一个角色同一个时间只能有一个ability
+/// </summary>
+public abstract class AbilityBase
+{
+ protected int m_AbilityID;
+ public int ID
+ {
+ get
+ {
+ return m_AbilityID;
+ }
+ }
+
+ public AbilityBase()
+ {
+ m_AbilityID = UIDManager.Acquire();
+ }
+
+ public virtual void OnInit() { }
+
+ /// <summary>
+ /// 进入当前ability的回调
+ /// </summary>
+ public virtual void OnEnter() { }
+
+ /// <summary>
+ /// 退出当前ability的回调
+ /// </summary>
+ public virtual void OnExit() { }
+
+ /// <summary>
+ /// 当前ability的update函数
+ /// </summary>
+ public virtual void OnUpdate() { }
+
+ /// <summary>
+ /// 过渡到下一个ability的回调
+ /// </summary>
+ /// <param name="to"></param>
+ public virtual void OnTranslate(AbilityBase to) { }
+
+ /// <summary>
+ /// 检测到hitbox碰撞时的回调
+ /// </summary>
+ public virtual void OnHit() { }
+
+ /// <summary>
+ /// 检测到hurtbox碰撞时的回调
+ /// </summary>
+ public virtual void OnHurt() { }
+
+ /// <summary>
+ /// 检测到defendbox碰撞时的回调
+ /// </summary>
+ public virtual void OnDefend() { }
+}
|