27 lines
703 B
C#
27 lines
703 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)
|
|||
|
{
|
|||
|
var 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;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|