27 lines
716 B
C#
27 lines
716 B
C#
namespace ET
|
||
{
|
||
/// <summary>
|
||
/// 监视hp数值变化,改变血条值
|
||
/// </summary>
|
||
[NumericWatcher(NumericType.MaxMp)]
|
||
public class NumericWatcher_MaxMp : INumericWatcher
|
||
{
|
||
public async ETTask Run(Entity entity, float old, float value)
|
||
{
|
||
NumericComponent num = entity.GetComponent<NumericComponent>();
|
||
|
||
if (value <= 0)
|
||
{
|
||
|
||
}
|
||
else if (value < num.GetAsInt(NumericType.Mp))
|
||
{
|
||
num.Set(NumericType.Mp, value);
|
||
}
|
||
DelaySendSyncAttributeComponent.instance.Add(entity.As<Unit>(), NumericType.MaxMp, value);
|
||
await ETTask.CompletedTask;
|
||
}
|
||
|
||
}
|
||
}
|