Skip to content

Commit

Permalink
Set player state to FREE after canceling UI wheel
Browse files Browse the repository at this point in the history
Or, in other words, after letting go of the `Select` button without having selected anything.
  • Loading branch information
ddabble committed Nov 24, 2021
1 parent b75b7c8 commit ad4b9fd
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions Assets/Scripts/Player/PlayerUi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,13 @@ public void Select()
//Turns off the UI if button no longer held
if (!state.Select)
{
if (selectedSegment)
if (selectedSegment
&& inventory.ResourceAmount - selectedSegment.cost >= 0)
{
if (inventory.ResourceAmount - selectedSegment.cost >= 0)
state.SetState(PlayerStates.FREE);
else
{
inventory.ResourceAmount -= selectedSegment.cost;
selectedSegment.InstantiateConstructionTower(state);
}
}
inventory.ResourceAmount -= selectedSegment.cost;
selectedSegment.InstantiateConstructionTower(state);
} else
state.SetState(PlayerStates.FREE);

ui.gameObject.SetActive(false);
}
Expand Down

0 comments on commit ad4b9fd

Please sign in to comment.