diff --git a/Scripts/PlayerMovement.cs b/Scripts/PlayerMovement.cs index 940231c4..7a618114 100644 --- a/Scripts/PlayerMovement.cs +++ b/Scripts/PlayerMovement.cs @@ -214,15 +214,17 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible private void FindInteractable() { - if (!Input.IsActionJustPressed("Use") || _selector.SelectedInteractable == null) return; - if (!_selector.SelectedInteractable.CanActivate()) return; - bool success = _selector.SelectedInteractable.Activate(); + var selected = _selector.SelectedInteractable; + if (!Input.IsActionJustPressed("Use") || selected == null) return; + if (!selected.CanActivate()) return; + bool success = selected.Activate(); if (success) { // Deselect and scan for next - _selector.SelectedInteractable = null; - _selector.SelectNext(); + _selector.RemoveInteractable(selected); + //_selector.SelectedInteractable = null; + //_selector.SelectNext(); } //var spaceState = GetWorld2D().DirectSpaceState; diff --git a/Scripts/Selector.cs b/Scripts/Selector.cs index 7ba564c4..7afdf4cd 100644 --- a/Scripts/Selector.cs +++ b/Scripts/Selector.cs @@ -49,14 +49,14 @@ public partial class Selector : Node2D SelectNext(); } - if (SelectedInteractable != null) { - this.Visible = true; - this.GlobalPosition = SelectedInteractable.GlobalPosition; - } - else - { - this.Visible = false; - } + // if (SelectedInteractable is not null) { + // this.Visible = true; + // this.GlobalPosition = SelectedInteractable.GlobalPosition; + // } + // else + // { + // this.Visible = false; + // } } public void SelectNext() @@ -115,7 +115,6 @@ public partial class Selector : Node2D public void UpdatePosition() { - return; if (SelectedInteractable != null) { this.Position = SelectedInteractable.Position;