From 3b036c6de871aa519a1f7fbfb52e09618945041f Mon Sep 17 00:00:00 2001
From: chai <215380520@qq.com>
Date: Mon, 15 May 2023 09:28:11 +0800
Subject: *misc
---
.../Assets/Scripts/Buffs/BuffBehaviour.cs | 81 +++++++++++++++++-----
1 file changed, 62 insertions(+), 19 deletions(-)
(limited to 'WorldlineKeepers/Assets/Scripts/Buffs/BuffBehaviour.cs')
diff --git a/WorldlineKeepers/Assets/Scripts/Buffs/BuffBehaviour.cs b/WorldlineKeepers/Assets/Scripts/Buffs/BuffBehaviour.cs
index 0a0559f..4e20202 100644
--- a/WorldlineKeepers/Assets/Scripts/Buffs/BuffBehaviour.cs
+++ b/WorldlineKeepers/Assets/Scripts/Buffs/BuffBehaviour.cs
@@ -2,31 +2,74 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
-public class BuffBehaviour
-{
- private CharacterBase m_Character;
-
- ///
- /// buff生成时候
- ///
- public virtual void OnCreate()
- {
+//https://zhuanlan.zhihu.com/p/150812545
+//https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Scripting/Abilities_Data_Driven/zh
- }
+namespace WK
+{
///
- /// 更新
+ /// Buff生命周期
+ /// 实例化 -> 加入列表前 -> 加入列表后 -> 更新 -> 移出列表前 -> 移出列表后
+ /// 每一步都会向当前对象作用域内广播消息
///
- public virtual void OnUpdate()
+ public abstract class BuffBehaviour
{
+ ///
+ /// buff实例化时
+ ///
+ public virtual void OnCreate()
+ {
- }
+ }
- ///
- /// 角色死亡
- ///
- public virtual void OnCharacterDeath()
- {
- }
+ ///
+ /// 获得这个buff(加入列表前)
+ ///
+ public virtual void OnBeforeAttach()
+ {
+ }
+
+ ///
+ /// 加入列表后,激活这个buff
+ ///
+ public virtual void OnAfterAttach()
+ {
+
+ }
+
+ ///
+ /// 第一次Update前
+ ///
+ public virtual void OnStart()
+ {
+
+ }
+
+ ///
+ /// 从列表移出前
+ ///
+ public virtual void OnBeforeDeattach()
+ {
+
+ }
+
+ ///
+ /// 移除这个buff(移出列表后)
+ ///
+ public virtual void OnAfterDeattach()
+ {
+
+ }
+
+ ///
+ /// 每帧逻辑更新(如果需要的话)
+ ///
+ public virtual void OnUpdate()
+ {
+
+ }
+
+ }
}
--
cgit v1.1-26-g67d0