UI/PanelComponents/BugHealthbar.razor
@using Sandbox;
@using Sandbox.UI;
@namespace Battlebugs
@inherits PanelComponent
<root style="opacity: @(Alpha)">
<div class="inner">
@if (true)
{
var amount = Segment.Health / Segment.Bug.StartingHealth;
<div class="fill" style="background-color: @(Gradient.Evaluate(1f - amount).Hex); width: @(amount * 100f)%;" )" />
}
</div>
</root>
@code
{
[Property] BugSegment Segment { get; set; }
[Property] public float Alpha { get; set; } = 0f;
[Property] Gradient Gradient { get; set; }
protected override int BuildHash() => System.HashCode.Combine(Alpha, Segment.Health);
}