43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
|
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace Game
|
||
|
{
|
||
|
public abstract class Buff
|
||
|
{
|
||
|
// 血量、蓝量、攻击力、防御力、攻击速度、回蓝速度、回血速度、
|
||
|
public string BuffName;
|
||
|
public float BuffDuration; // Buff 持续时间(秒)
|
||
|
public float TimeRemaining; // 剩余时间
|
||
|
public Character ApplyCharacter;
|
||
|
|
||
|
protected Buff(string buffName, float buffDuration)
|
||
|
{
|
||
|
BuffName = buffName;
|
||
|
BuffDuration = buffDuration;
|
||
|
}
|
||
|
|
||
|
// Buff 更新,减少剩余时间
|
||
|
public void Update(float deltaTime)
|
||
|
{
|
||
|
TimeRemaining -= deltaTime;
|
||
|
if (TimeRemaining <= 0)
|
||
|
{
|
||
|
OnBuffExpire();
|
||
|
}
|
||
|
} // Buff 过期时调用
|
||
|
|
||
|
protected virtual void OnBuffExpire()
|
||
|
{
|
||
|
Debug.Log($"{BuffName} expired!");
|
||
|
}
|
||
|
|
||
|
// Buff 应用效果
|
||
|
public abstract void ApplyEffect(Character character);
|
||
|
|
||
|
// Buff 移除效果
|
||
|
public abstract void RemoveEffect(Character character);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|