From 1d069e2433846d25c50ee21bbab2b249a3696334 Mon Sep 17 00:00:00 2001 From: Fredrik Eiding Date: Sun, 12 Mar 2023 22:09:25 +0100 Subject: [PATCH] Fixed various bugs related to playerUI menu state toggle. --- Assets/Scripts/Player/PlayerSpecificManager.cs | 1 - Assets/Scripts/Player/PlayerStateController.cs | 6 ++++-- Assets/Scripts/Player/PlayerUi.cs | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Player/PlayerSpecificManager.cs b/Assets/Scripts/Player/PlayerSpecificManager.cs index f806ac3..8056df0 100644 --- a/Assets/Scripts/Player/PlayerSpecificManager.cs +++ b/Assets/Scripts/Player/PlayerSpecificManager.cs @@ -1,6 +1,5 @@ using System.Collections; using System.Collections.Generic; -using UnityEditor.UI; using UnityEngine; using UnityEngine.InputSystem; diff --git a/Assets/Scripts/Player/PlayerStateController.cs b/Assets/Scripts/Player/PlayerStateController.cs index 1060b42..c7642f7 100644 --- a/Assets/Scripts/Player/PlayerStateController.cs +++ b/Assets/Scripts/Player/PlayerStateController.cs @@ -152,8 +152,10 @@ void FixedUpdate() } if (Interact && !ui.GetBuildToggle()) - SetState(PlayerStates.FREE); - + { + OnInteract(); + //SetState(PlayerStates.FREE); + } break; } } diff --git a/Assets/Scripts/Player/PlayerUi.cs b/Assets/Scripts/Player/PlayerUi.cs index a766c7d..d2d7b9b 100644 --- a/Assets/Scripts/Player/PlayerUi.cs +++ b/Assets/Scripts/Player/PlayerUi.cs @@ -43,6 +43,7 @@ public void SetActiveUI(bool value) public void ToggleBuildMenu() { + if (playerStateController.CurrentState == PlayerStates.BUILDING) { return; } buildToggle = !buildToggle; SetActiveUI(buildToggle); if (buildToggle)