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

65 lines
1.5 KiB
C#
Raw Normal View History

2023-10-19 15:00:19 +08:00
using CodeStage.AntiCheat.ObscuredTypes;
2023-12-19 15:01:19 +08:00
using Gameplay.PlayerSkill.Data;
2023-12-13 16:20:41 +08:00
namespace Gameplay.Unit.Data
2023-08-22 19:08:45 +08:00
{
public class UnitAliveData
{
public GameUnit owner;
2023-08-22 19:08:45 +08:00
/// <summary>
/// 血量
/// </summary>
2023-10-19 15:00:19 +08:00
public ObscuredInt currentHp;
2023-08-22 19:08:45 +08:00
/// <summary>
/// 护甲值
/// </summary>
2023-10-19 15:00:19 +08:00
public ObscuredInt currentShield;
2023-08-22 19:08:45 +08:00
/// <summary>
/// 士气值
/// </summary>
2023-10-19 15:00:19 +08:00
public ObscuredInt currentMorale;
public int hpAndShield
{
get
{
return currentHp + currentShield;
}
}
2023-08-22 19:08:45 +08:00
2023-10-19 15:00:19 +08:00
public ObscuredInt maxHp;
public ObscuredInt maxShield;
public ObscuredInt maxMorale;
2023-08-22 19:08:45 +08:00
public UnitAliveData(GameUnit owner)
{
this.owner = owner;
}
public void Init(bool fillHp)
2023-08-22 19:08:45 +08:00
{
if (fillHp)
{
currentHp = maxHp;
currentShield = maxShield;
}
2023-08-22 19:08:45 +08:00
currentMorale = maxMorale;
}
2023-12-19 15:01:19 +08:00
public void Revive(UnitReviveData reviveData)
{
currentHp = (int)(maxHp * reviveData.hpPercent);
currentShield = (int)(maxShield * reviveData.shieldPercent);
}
2024-05-31 19:44:10 +08:00
public void FullStatus()
{
currentHp = maxHp;
currentShield = maxShield;
currentMorale = maxMorale;
}
2023-08-22 19:08:45 +08:00
}
}