diff --git a/Assets/Prefabs/House.meta b/Assets/Prefabs/Interior.meta similarity index 100% rename from Assets/Prefabs/House.meta rename to Assets/Prefabs/Interior.meta diff --git a/Assets/Prefabs/House/Bed.prefab b/Assets/Prefabs/Interior/Bed.prefab similarity index 100% rename from Assets/Prefabs/House/Bed.prefab rename to Assets/Prefabs/Interior/Bed.prefab diff --git a/Assets/Prefabs/House/Bed.prefab.meta b/Assets/Prefabs/Interior/Bed.prefab.meta similarity index 100% rename from Assets/Prefabs/House/Bed.prefab.meta rename to Assets/Prefabs/Interior/Bed.prefab.meta diff --git a/Assets/Prefabs/House/CheapFridge.prefab b/Assets/Prefabs/Interior/CheapFridge.prefab similarity index 100% rename from Assets/Prefabs/House/CheapFridge.prefab rename to Assets/Prefabs/Interior/CheapFridge.prefab diff --git a/Assets/Prefabs/House/CheapFridge.prefab.meta b/Assets/Prefabs/Interior/CheapFridge.prefab.meta similarity index 100% rename from Assets/Prefabs/House/CheapFridge.prefab.meta rename to Assets/Prefabs/Interior/CheapFridge.prefab.meta diff --git a/Assets/Prefabs/House/Fridge.prefab b/Assets/Prefabs/Interior/Fridge.prefab similarity index 100% rename from Assets/Prefabs/House/Fridge.prefab rename to Assets/Prefabs/Interior/Fridge.prefab diff --git a/Assets/Prefabs/House/Fridge.prefab.meta b/Assets/Prefabs/Interior/Fridge.prefab.meta similarity index 100% rename from Assets/Prefabs/House/Fridge.prefab.meta rename to Assets/Prefabs/Interior/Fridge.prefab.meta diff --git a/Assets/Prefabs/House/House.prefab b/Assets/Prefabs/Interior/House.prefab similarity index 100% rename from Assets/Prefabs/House/House.prefab rename to Assets/Prefabs/Interior/House.prefab diff --git a/Assets/Prefabs/House/House.prefab.meta b/Assets/Prefabs/Interior/House.prefab.meta similarity index 100% rename from Assets/Prefabs/House/House.prefab.meta rename to Assets/Prefabs/Interior/House.prefab.meta diff --git a/Assets/Prefabs/House/NavMesh-Floor.asset b/Assets/Prefabs/Interior/NavMesh-Floor.asset similarity index 100% rename from Assets/Prefabs/House/NavMesh-Floor.asset rename to Assets/Prefabs/Interior/NavMesh-Floor.asset diff --git a/Assets/Prefabs/House/NavMesh-Floor.asset.meta b/Assets/Prefabs/Interior/NavMesh-Floor.asset.meta similarity index 100% rename from Assets/Prefabs/House/NavMesh-Floor.asset.meta rename to Assets/Prefabs/Interior/NavMesh-Floor.asset.meta diff --git a/Assets/Scenes/House.unity b/Assets/Scenes/House.unity index 5b70d290..41e69ad6 100644 --- a/Assets/Scenes/House.unity +++ b/Assets/Scenes/House.unity @@ -9258,7 +9258,7 @@ MonoBehaviour: _jobSelectorPrefab: {fileID: 3776407727599883163, guid: 2ad5edd099127044684eeca456ed3d00, type: 3} _blurOverlay: {fileID: 1972616679270001457} - _itemPopupMenuPrefab: {fileID: 5424962769672562944, guid: 543443cf1b9e73b4193a13044eda04d2, + _radialMenuItemPrefab: {fileID: 5424962769672562944, guid: 543443cf1b9e73b4193a13044eda04d2, type: 3} --- !u!222 &1315590696984075725 CanvasRenderer: diff --git a/Assets/Scripts/InteractableObjects/BaseInteractableObject.cs b/Assets/Scripts/InteractableObjects/BaseInteractableObject.cs index 247e571f..4c4449ed 100644 --- a/Assets/Scripts/InteractableObjects/BaseInteractableObject.cs +++ b/Assets/Scripts/InteractableObjects/BaseInteractableObject.cs @@ -15,27 +15,30 @@ public class BaseInteractableObject : MonoBehaviour public InteractionStatus Interact(Player player) { _player = player; - if (_currentStatus == InteractionStatus.None && _menuActions.Any()) + switch (_currentStatus) { - UIManager.Instance.ShowItemsMenu(_menuActions, PopupMenuCallback); - _currentStatus = InteractionStatus.WaitForChoose; - } - else if (_currentStatus == InteractionStatus.Complete) - { - _currentStatus = InteractionStatus.None; - return InteractionStatus.Complete; - } - else if (_currentStatus != InteractionStatus.WaitForChoose && _currentStatus != InteractionStatus.Complete) - { - if (_player.IsPathComplete(_interactionPoint.position)) - { - InteractAction(); - _currentStatus = InteractionStatus.Complete; - } - else - { - _currentStatus = InteractionStatus.FarFromPlayer; - } + case InteractionStatus.None when _menuActions.Any(): + UIManager.Instance.ShowItemsMenu(_menuActions, PopupMenuCallback); + _currentStatus = InteractionStatus.WaitForChoose; + break; + case InteractionStatus.Complete: + _currentStatus = InteractionStatus.None; + return InteractionStatus.Complete; + default: + if (_currentStatus != InteractionStatus.WaitForChoose && _currentStatus != InteractionStatus.Complete) + { + if (_player.IsPathComplete(_interactionPoint.position)) + { + InteractAction(); + _currentStatus = InteractionStatus.None; + return InteractionStatus.Complete; + } + else + { + _currentStatus = InteractionStatus.FarFromPlayer; + } + } + break; } return _currentStatus; } diff --git a/Assets/Scripts/UIElements/RadialMenuItem.cs b/Assets/Scripts/UIElements/RadialMenuItem.cs index 36ceca3d..0f2a542b 100644 --- a/Assets/Scripts/UIElements/RadialMenuItem.cs +++ b/Assets/Scripts/UIElements/RadialMenuItem.cs @@ -8,9 +8,13 @@ public class RadialMenuItem : MonoBehaviour { [SerializeField] private Button _radialMenuItemPrefab; + private Action _menuButtonClick=null; + List _actions; public void ShowButtons(List actions, Action menuButtonClick) { + _actions = actions; + _menuButtonClick = menuButtonClick; for (int buttonsCount = 0; buttonsCount < actions.Count; buttonsCount++) { var button = Instantiate(_radialMenuItemPrefab); @@ -27,14 +31,20 @@ public class RadialMenuItem : MonoBehaviour textMeshPro.text = actions[buttonsCount].ActionName; } - button.onClick.AddListener(() => - { - Hide(); - CloseDialog(); - menuButtonClick?.Invoke(actions[1]); - }); + AddEvent(button, buttonsCount); } } + + void AddEvent(Button b, int i) + { + b.onClick.AddListener(() => + { + Hide(); + _menuButtonClick?.Invoke(_actions[i]); + CloseDialog(); + }); + } + private void CloseDialog() { UIManager.Instance.Unfreeze();