Made selector 3D

This commit is contained in:
Marco 2025-08-07 15:09:02 +02:00
commit 0a7b1614a9
8 changed files with 113 additions and 45 deletions

View file

@ -48,12 +48,8 @@ public partial class IsoActivationProvider: Area3D, IModule<PlayerState, Charact
StateMachine = machine;
_selectorController.Hide();
if (Hud.Instance is not null)
{
Hud.Instance.CreateSelector(_selectorController);
}
SpawnSelector();
// if (SelectorScene is not null && _selector is null)
// {
@ -62,6 +58,43 @@ public partial class IsoActivationProvider: Area3D, IModule<PlayerState, Charact
// }
}
private void SpawnSelector()
{
var sel = SelectorScene.Instantiate<Node3D>();
StateMachine.MainObject.GetParent().AddChild(sel);
sel.GlobalPosition = StateMachine.MainObject.GlobalPosition;
_selectorController.ShowSelector += () =>
{
sel.Show();
};
_selectorController.HideSelector += () =>
{
sel.Reparent(this);
sel.Hide();
};
_selectorController.ChangeParent3D += parent =>
{
if (parent is not null)
{
sel.Reparent(parent);
}
else
{
sel.Reparent(this);
sel.Hide();
}
sel.Position = Vector3.Zero;
};
// if (Hud.Instance is not null)
// {
// Hud.Instance.CreateSelector(_selectorController);
// }
}
public void Process(double delta)
{
@ -69,7 +102,7 @@ public partial class IsoActivationProvider: Area3D, IModule<PlayerState, Charact
public void PhysicsProcess(double delta)
{
_selectorController.PhysicsProcess(delta);
//_selectorController.PhysicsProcess(delta);
HandleInteraction();
}
@ -110,6 +143,7 @@ public partial class IsoActivationProvider: Area3D, IModule<PlayerState, Charact
if (success)
{
// Deselect and scan for next
_selectorController.RemoveInteractable(selected);
_selectorController.SelectNext();
//_selector.RemoveInteractable(selected);
}