A Razor UI panel that renders a damage flash overlay when the referenced BreakoutGame reports damage. It conditionally emits a div with class "flash" while Game.IsValid() and Game.DamageActive are true, and uses BuildHash to invalidate/rebuild when DamageSeq or DamageActive change.
@using System
@using Sandbox
@using Sandbox.UI
@namespace Breakout
@inherits Panel
@if ( Game.IsValid() && Game.DamageActive )
{
<root>
<div class="flash"></div>
</root>
}
@code
{
/// <summary>
/// The game whose damage state this overlay mirrors.
/// </summary>
[Parameter] public BreakoutGame Game { get; set; }
protected override int BuildHash() => System.HashCode.Combine( Game?.DamageSeq, Game?.DamageActive );
}