2021-04-08 20:09:59 +08:00
|
|
|
|
using ET;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
[NumericWatcher(NumericType.Energy)]
|
|
|
|
|
public class NumericWatcher_Energy : INumericWatcher
|
|
|
|
|
{
|
|
|
|
|
public async ETTask Run(Entity entity, float old, float value)
|
|
|
|
|
{
|
|
|
|
|
Log.Info($"@{entity.Id}改变 Energy:{old} -> {value}");
|
2021-04-20 00:25:04 +08:00
|
|
|
|
if (entity.Id != entity.ZoneScene().GetComponent<GlobalVariable>().MyId) return;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
int energy = MathHelper.RoundToInt(value);
|
|
|
|
|
Game.EventSystem.Publish_Sync(new ET.EventType.ChangeEnergy
|
|
|
|
|
{
|
|
|
|
|
energy = energy,
|
|
|
|
|
});
|
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|