mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-07-04 13:21:17 +00:00
Partial selector fix
This commit is contained in:
parent
f7cbd7d171
commit
882608be72
2 changed files with 15 additions and 14 deletions
|
|
@ -214,15 +214,17 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
|
||||||
|
|
||||||
private void FindInteractable()
|
private void FindInteractable()
|
||||||
{
|
{
|
||||||
if (!Input.IsActionJustPressed("Use") || _selector.SelectedInteractable == null) return;
|
var selected = _selector.SelectedInteractable;
|
||||||
if (!_selector.SelectedInteractable.CanActivate()) return;
|
if (!Input.IsActionJustPressed("Use") || selected == null) return;
|
||||||
bool success = _selector.SelectedInteractable.Activate();
|
if (!selected.CanActivate()) return;
|
||||||
|
bool success = selected.Activate();
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
// Deselect and scan for next
|
// Deselect and scan for next
|
||||||
_selector.SelectedInteractable = null;
|
_selector.RemoveInteractable(selected);
|
||||||
_selector.SelectNext();
|
//_selector.SelectedInteractable = null;
|
||||||
|
//_selector.SelectNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
//var spaceState = GetWorld2D().DirectSpaceState;
|
//var spaceState = GetWorld2D().DirectSpaceState;
|
||||||
|
|
|
||||||
|
|
@ -49,14 +49,14 @@ public partial class Selector : Node2D
|
||||||
SelectNext();
|
SelectNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedInteractable != null) {
|
// if (SelectedInteractable is not null) {
|
||||||
this.Visible = true;
|
// this.Visible = true;
|
||||||
this.GlobalPosition = SelectedInteractable.GlobalPosition;
|
// this.GlobalPosition = SelectedInteractable.GlobalPosition;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
this.Visible = false;
|
// this.Visible = false;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectNext()
|
public void SelectNext()
|
||||||
|
|
@ -115,7 +115,6 @@ public partial class Selector : Node2D
|
||||||
|
|
||||||
public void UpdatePosition()
|
public void UpdatePosition()
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
if (SelectedInteractable != null)
|
if (SelectedInteractable != null)
|
||||||
{
|
{
|
||||||
this.Position = SelectedInteractable.Position;
|
this.Position = SelectedInteractable.Position;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue