NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Unit/Data/UnitAliveData.cs

65 lines
1.4 KiB
C#

using CodeStage.AntiCheat.ObscuredTypes;
using Gameplay.PlayerSkill.Data;
namespace Gameplay.Unit.Data
{
public class UnitAliveData
{
public GameUnit owner;
/// <summary>
/// 血量
/// </summary>
public int currentHp;
/// <summary>
/// 护甲值
/// </summary>
public ObscuredInt currentShield;
/// <summary>
/// 士气值
/// </summary>
public int currentMorale;
public int hpAndShield
{
get
{
return currentHp + currentShield;
}
}
public ObscuredInt maxHp;
public ObscuredInt maxShield;
public ObscuredInt maxMorale;
public UnitAliveData(GameUnit owner)
{
this.owner = owner;
}
public void Init(bool fillHp)
{
if (fillHp)
{
currentHp = maxHp;
currentShield = maxShield;
}
currentMorale = maxMorale;
}
public void Revive(UnitReviveData reviveData)
{
currentHp = (int)(maxHp * reviveData.hpPercent);
currentShield = (int)(maxShield * reviveData.shieldPercent);
}
public void FullStatus()
{
currentHp = maxHp;
currentShield = maxShield;
currentMorale = maxMorale;
}
}
}