HQ/DelayedRelocate.cs
namespace PlanetMeat;
[Group( "Planet Meat - HQ" ), Title( "Delayed Relocate" ), Icon( "departure_board" )]
public sealed class DelayedRelocate : Component
{
[Property] public float Delay { get; set; } = 1.5f;
[Property] public LaunchedDrill Drill { get; set; }
private int startRound = 1;
private float delayTime = -1.0f;
public bool Travelling => Drill.Launched;
protected override void OnUpdate()
{
base.OnUpdate();
if ( delayTime > 0.0f )
{
delayTime -= Time.Delta;
if ( delayTime < 0.01f )
{
delayTime = -1.0f;
Agenda.Current.RelocateToArena( startRound );
}
}
}
public void BeginRelocation( int round = 1 )
{
startRound = round;
delayTime = Delay;
Drill.Launched = true;
}
}