A Razor UI component for the player HUD that intends to show the Engie turret's current and max health when the local player and Engie player with an active turret exist. It reads local player pawn and EngiePlayer component, and renders a label with currentHealth/maxHealth.
@* @namespace KOTH.UI
@inherits Panel
@attribute [StyleSheet]
@if (!Player.IsValid() || !EngiePlayer.IsValid() || EngiePlayer.ActiveTurretComponent == null)
{
return;
}
<root>
<label class="building">@(EngiePlayer.ActiveTurretComponent.DamageComponent.Health)/@(EngiePlayer.ActiveTurretComponent.DamageComponent.MaxBaseHealth)</label>
</root>
@code
{
public PlayerPawn Player => PlayerState.Local.PlayerPawn;
public EngiePlayer EngiePlayer => Player.GameObject.GetComponent<EngiePlayer>();
protected override int BuildHash()
{
if (!Player.IsValid())
return 0;
return HashCode.Combine(Time.Now);
}
}
*@