HQ/LaunchedDrill.cs
namespace PlanetMeat;
[Group( "Planet Meat - HQ" ), Title( "Launched Drill" ), Icon( "rocket_launch" )]
public sealed class LaunchedDrill : Component
{
[Property] public Vector3 Trajectory { get; set; } = new( 500.0f, 0.0f, 0.0f );
[Property] public Vector3 Acceleration { get; set; } = new( 100.0f, 0.0f, 0.0f );
private Vector3 velocity = Vector3.Zero;
public bool Launched
{
get;
set
{
field = value;
velocity = Trajectory;
if ( value )
Sound.Play( "launch" );
}
} = false;
protected override void OnUpdate()
{
base.OnUpdate();
if ( Launched )
{
WorldPosition += velocity * Time.Delta;
velocity += Acceleration * Time.Delta;
}
}
}