|
@@ -5,6 +5,7 @@ using ET;
|
|
|
using ET.EventType;
|
|
|
using Sirenix.Utilities;
|
|
|
using System;
|
|
|
+using XmdsCommon.Plugin;
|
|
|
|
|
|
public class BattleUnit : BattleObject
|
|
|
{
|
|
@@ -148,25 +149,45 @@ public class BattleUnit : BattleObject
|
|
|
throw new NotImplementedException();
|
|
|
}
|
|
|
|
|
|
- protected virtual void OnMaxHPChanged(ZoneUnit unit, int oldMaxHP, int newMaxHP)
|
|
|
+ protected virtual void OnMPChanged(ZoneUnit unit, int oldMP, int newMP)
|
|
|
{
|
|
|
throw new NotImplementedException();
|
|
|
}
|
|
|
|
|
|
- protected virtual void OnMPChanged(ZoneUnit unit, int oldMP, int newMP)
|
|
|
+ protected virtual void OnMaxHPChanged(ZoneUnit unit, int oldMaxHP, int newMaxHP)
|
|
|
{
|
|
|
- throw new NotImplementedException();
|
|
|
+ OnHPChanged();
|
|
|
}
|
|
|
-
|
|
|
protected virtual void OnHPChanged(ZoneUnit unit, int oldHP, int newHP)
|
|
|
{
|
|
|
- Log.Debug($"hp({unit.ObjectID}) change, {oldHP}-->{newHP}");
|
|
|
+ OnHPChanged();
|
|
|
+ }
|
|
|
+ private void OnHPChanged()
|
|
|
+ {
|
|
|
+ var prop = ZUnit.Info.Properties as XmdsUnitProperties;
|
|
|
+ if (prop != null)
|
|
|
+ {
|
|
|
+ if(prop.GameStatusType == XmdsUnitProperties.StatusType.SpecialElite)
|
|
|
+ {
|
|
|
+ var hp = ZUnit.HP;
|
|
|
+ var pg = (float)ZUnit.HP * 100 / ZUnit.MaxHP;
|
|
|
+ EventSystem.Instance.Publish<HPRefresh>(HPRefresh.Static.Clone(HPRefresh.Index.Tower, pg, hp));
|
|
|
+ Log.Debug($"tower({ZUnit.ObjectID}@{ZUnit.Info.Name}) hp: {ZUnit.HP}/{ZUnit.MaxHP}");
|
|
|
+ }
|
|
|
+ else if(prop.GameStatusType == XmdsUnitProperties.StatusType.SpecialBoss)
|
|
|
+ {
|
|
|
+ var hp = ZUnit.HP;
|
|
|
+ var pg = (float)ZUnit.HP * 100 / ZUnit.MaxHP;
|
|
|
+ EventSystem.Instance.Publish<HPRefresh>(HPRefresh.Static.Clone(HPRefresh.Index.Boss, pg, hp));
|
|
|
+ Log.Debug($"Boss({ZUnit.ObjectID}) hp: {ZUnit.HP}/{ZUnit.MaxHP}");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //Log.Debug($"hp({ZUnit.ObjectID}) change: {ZUnit.HP}");
|
|
|
}
|
|
|
|
|
|
protected virtual void OnSkillActionChanged(ZoneUnit unit, ZoneUnit.SkillState skill, byte index)
|
|
|
{
|
|
|
//技能状态
|
|
|
-
|
|
|
}
|
|
|
|
|
|
protected virtual void OnActionChanged(ZoneUnit unit, UnitActionStatus status, object evt)
|