GameOverScreen.razor
@using Sandbox;
@using Sandbox.UI;
@inherits PanelComponent
@namespace Sandbox
<root>
<div class="title">Game over!</div>
<div class="survivaltime">You survived <strong>@Waves</strong> waves!</div>
<button onclick=@((e) => TryAgain())>Try again!</button>
</root>
@code
{
private void TryAgain()
{
Scene.LoadFromFile("scenes/minimal.scene");
}
[Property]
public int Waves { get; set; }
/// <summary>
/// the hash determines if the system should be rebuilt. If it changes, it will be rebuilt
/// </summary>
protected override int BuildHash() => System.HashCode.Combine( Waves );
}