CTT/Unity/Assets/Hotfix/Logic/Model/Module/Numeric/NumericWatcher_Level.cs

39 lines
1.1 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using ET;
namespace ET
{
/// <summary>
/// 监视hp数值变化改变血条值
/// </summary>
[NumericWatcher(NumericType.Level)]
public class NumericWatcher_Level : INumericWatcher
{
public async ETTask Run(Entity entity, float old, float value)
{
Log.Info($"@{entity.Id}改变 Level:{old} -> {value}");
2021-04-11 19:50:39 +08:00
Unit unit = entity.As<Unit>();
2021-04-08 20:09:59 +08:00
Game.EventSystem.Publish_Sync(new ET.EventType.SetHudCharacter_ChangeLevel
{
unit = unit,
level = (int)value
});
Game.EventSystem.Publish_Sync(new ET.EventType.UpdateHeadInfo_ChangeLevel
{
zoneScene = entity.ZoneScene(),
2021-04-08 20:09:59 +08:00
unit = unit,
old = (int)old,
value = (int)value,
duration = 0.6f,
});
Game.EventSystem.Publish_Sync(new ET.EventType.UpdateHeadInfo_ChangeMaxExp
{
zoneScene = entity.ZoneScene(),
2021-04-08 20:09:59 +08:00
unit = unit,
level = (int)value,
});
await ETTask.CompletedTask;
}
}
}