mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 02:35:54 +00:00
Automatic box deselection
This commit is contained in:
parent
cc5376e94e
commit
ad985ce1ac
6 changed files with 73 additions and 19 deletions
|
|
@ -46,18 +46,31 @@ public partial class Selector : Node2D
|
|||
{
|
||||
if (Input.IsActionJustPressed("scan"))
|
||||
{
|
||||
_selectedInteractable += 1;
|
||||
if (_selectedInteractable >= _interactables.Count)
|
||||
{
|
||||
_selectedInteractable = 0;
|
||||
}
|
||||
|
||||
SelectedInteractable = _interactables[_selectedInteractable];
|
||||
UpdatePosition();
|
||||
SelectNext();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectNext()
|
||||
{
|
||||
_selectedInteractable += 1;
|
||||
if (_selectedInteractable >= _interactables.Count)
|
||||
{
|
||||
_selectedInteractable = 0;
|
||||
}
|
||||
|
||||
if (_interactables.Count > 0)
|
||||
{
|
||||
SelectedInteractable = _interactables[_selectedInteractable];
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedInteractable = -1;
|
||||
}
|
||||
|
||||
UpdatePosition();
|
||||
}
|
||||
|
||||
private void NotifyChanged(Interactable interactable)
|
||||
{
|
||||
EmitSignal(nameof(SelectedItemInteractableChanged), interactable);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue