Player/PlayerDragTool.cs
namespace PlanetMeat;

[Group( "Planet Meat - Tools" ), Title( "Player Drag Tool" ), Icon( "touch_app" )]
public abstract class PlayerDragTool : PlayerTool
{
	protected bool Dragging { get; set; } = false;
	protected Vector3 DragStart { get; set; } = Vector3.Zero;

	protected virtual bool CanDrag => false;

	public override void OnPlaceStarted( Vector3 position )
	{
		if ( CanDrag )
		{
			Dragging = true;
			DragStart = position;
			OnDragStarted( position );
		}
	}
	protected virtual void OnDragStarted( Vector3 position ) { }

	public override void OnPlaceUpdated( Vector3 fromPosition, Vector3 toPosition )
	{
		if ( Dragging )
			OnDragUpdated( fromPosition, toPosition );
	}
	protected virtual void OnDragUpdated( Vector3 fromPosition, Vector3 toPosition ) { }


	public override void OnPlaceEnded( Vector3 position )
	{
		if ( Dragging )
			OnDragEnded( position );
	}
	protected virtual void OnDragEnded( Vector3 position ) { }
}