diff --git a/Assets/01.Scenes/01.Tycoon.unity b/Assets/01.Scenes/01.Tycoon.unity index 9344b7359..8429632d7 100644 --- a/Assets/01.Scenes/01.Tycoon.unity +++ b/Assets/01.Scenes/01.Tycoon.unity @@ -3774,7 +3774,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 + m_RaycastTarget: 0 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: diff --git a/Assets/02.Scripts/BehaviorTree/Npc/Crew/Action/IsCompletedMission.cs b/Assets/02.Scripts/BehaviorTree/Npc/Crew/Action/IsCompletedMission.cs index 53d0655c7..e86af0d53 100644 --- a/Assets/02.Scripts/BehaviorTree/Npc/Crew/Action/IsCompletedMission.cs +++ b/Assets/02.Scripts/BehaviorTree/Npc/Crew/Action/IsCompletedMission.cs @@ -15,7 +15,12 @@ namespace BlueWater.BehaviorTrees.Actions public override TaskStatus OnUpdate() { - return _crew.IsCompletedMission() ? TaskStatus.Success : TaskStatus.Running; + if (_crew.CrewInteraction != null) + { + return _crew.CrewInteraction.CanInteractionCrew() ? TaskStatus.Running : TaskStatus.Failure; + } + + return _crew.IsCompletedMission() ? TaskStatus.Success : TaskStatus.Failure; } } } \ No newline at end of file diff --git a/Assets/02.Scripts/BehaviorTree/Npc/Crew/Conditional/Serving.cs b/Assets/02.Scripts/BehaviorTree/Npc/Crew/Conditional/Serving.cs index 8c5b2460e..ddf2e3f7c 100644 --- a/Assets/02.Scripts/BehaviorTree/Npc/Crew/Conditional/Serving.cs +++ b/Assets/02.Scripts/BehaviorTree/Npc/Crew/Conditional/Serving.cs @@ -16,9 +16,9 @@ namespace BlueWater.BehaviorTrees.Actions public override void OnStart() { - if (_serverCrew.OrderedCustomer && _serverCrew.OrderedCustomer.CanInteractionCrew()) + if (_serverCrew.OrderedCustomer) { - _serverCrew.OrderedCustomer.IsMatchedServer = true; + _serverCrew.OrderedCustomer.TryMatchedServer(); } if (_serverCrew.CrewInteraction != null) diff --git a/Assets/02.Scripts/Character/Npc/Crew/Cleaner/CleanerCrew.cs b/Assets/02.Scripts/Character/Npc/Crew/Cleaner/CleanerCrew.cs index fff7ea851..30f2f844a 100644 --- a/Assets/02.Scripts/Character/Npc/Crew/Cleaner/CleanerCrew.cs +++ b/Assets/02.Scripts/Character/Npc/Crew/Cleaner/CleanerCrew.cs @@ -43,7 +43,7 @@ namespace BlueWater.Npcs.Crews.Cleaner public override bool IsCompletedMission() { - return CrewInteraction == null && !IsCleaningFloor && !IsCleaningTable; + return !IsCleaningFloor && !IsCleaningTable; } public void SetIsCleaningFloor(bool value) => IsCleaningFloor = value; diff --git a/Assets/02.Scripts/Character/Npc/Crew/Server/ServerCrew.cs b/Assets/02.Scripts/Character/Npc/Crew/Server/ServerCrew.cs index 38b7a208f..94360b872 100644 --- a/Assets/02.Scripts/Character/Npc/Crew/Server/ServerCrew.cs +++ b/Assets/02.Scripts/Character/Npc/Crew/Server/ServerCrew.cs @@ -63,7 +63,7 @@ namespace BlueWater.Npcs.Crews.Server public override bool IsCompletedMission() { - return CrewInteraction == null && !OrderedCustomer && CurrentPickupItem == null && !IsServing; + return !OrderedCustomer && CurrentPickupItem == null && !IsServing; } public void OnMission(ICrewInteraction crewInteraction, Customer orderedCustomer, ActionType actionType) diff --git a/Assets/02.Scripts/Character/Npc/Customer/Customer.cs b/Assets/02.Scripts/Character/Npc/Customer/Customer.cs index 4b164d215..2ef0b2787 100644 --- a/Assets/02.Scripts/Character/Npc/Customer/Customer.cs +++ b/Assets/02.Scripts/Character/Npc/Customer/Customer.cs @@ -90,7 +90,7 @@ namespace BlueWater.Npcs.Customers public float InteractionRadius { get; private set; } = 2f; [field: SerializeField] - public string InteractionMessage { get; set; } + public string InteractionMessage { get; private set; } [SerializeField] private Vomiting _vomiting; @@ -106,22 +106,22 @@ namespace BlueWater.Npcs.Customers public CocktailData OrderedCocktailData { get; private set; } [field: SerializeField] - public Bill CurrentBill { get; set; } + public Bill CurrentBill { get; private set; } [field: SerializeField] - public bool IsMatchedServer { get; set; } + public bool IsMatchedServer { get; private set; } [field: SerializeField] - public bool IsReceivedItem { get; set; } + public bool IsReceivedItem { get; private set; } [field: SerializeField] - public bool IsOrderedSucceed { get; set; } + public bool IsOrderedSucceed { get; private set; } [SerializeField] private CustomerInteractionType _customerInteractionType; public bool IsMoving { get; private set; } - public bool IsVomited { get; set; } + public bool IsVomited { get; private set; } private Vector3 _currentDirection = Vector3.right; @@ -475,6 +475,15 @@ namespace BlueWater.Npcs.Customers return CurrentTableSeat && !IsReceivedItem; } + public void TryMatchedServer() + { + if (!CanInteractionCrew()) return; + + IsMatchedServer = true; + } + + public void SetCurrentBill(Bill bill) => CurrentBill = bill; + #endregion } } \ No newline at end of file diff --git a/Assets/02.Scripts/PlayerInputKeyManager.cs b/Assets/02.Scripts/PlayerInputKeyManager.cs index b59b824c9..b4ec0b742 100644 --- a/Assets/02.Scripts/PlayerInputKeyManager.cs +++ b/Assets/02.Scripts/PlayerInputKeyManager.cs @@ -107,5 +107,33 @@ namespace BlueWater action.Enable(); } } + + public void EnableAction(string actionName) + { + if (IsNullCurrentPlayerInput()) return; + + var action = _currentPlayerInput.currentActionMap.FindAction(actionName); + if (action == null) + { + Debug.Log($"현재 Action Map인 {_currentPlayerInput.currentActionMap}에는 {actionName} Action이 존재하지 않습니다"); + return; + } + + action.Enable(); + } + + public void DisableAction(string actionName) + { + if (IsNullCurrentPlayerInput()) return; + + var action = _currentPlayerInput.currentActionMap.FindAction(actionName); + if (action == null) + { + Debug.Log($"현재 Action Map인 {_currentPlayerInput.currentActionMap}에는 {actionName} Action이 존재하지 않습니다"); + return; + } + + action.Disable(); + } } } \ No newline at end of file diff --git a/Assets/02.Scripts/Prop/Tycoon/Vomiting.cs b/Assets/02.Scripts/Prop/Tycoon/Vomiting.cs index a0f1a34d3..a85a4d263 100644 --- a/Assets/02.Scripts/Prop/Tycoon/Vomiting.cs +++ b/Assets/02.Scripts/Prop/Tycoon/Vomiting.cs @@ -27,6 +27,13 @@ namespace BlueWater.Tycoons Initialize(); } + protected override void Start() + { + base.Start(); + + EventManager.OnCleaningAll += Destroy; + } + private void Update() { if (InteractionCanvas.BalloonUi.IsWaitTimeOver()) @@ -69,6 +76,11 @@ namespace BlueWater.Tycoons } } } + + private void OnDestroy() + { + EventManager.OnCleaningAll -= Destroy; + } public void Initialize() { diff --git a/Assets/02.Scripts/Tycoon/TycoonGameOver.cs b/Assets/02.Scripts/Tycoon/TycoonGameOver.cs index cfc6aa62e..bf532bdb2 100644 --- a/Assets/02.Scripts/Tycoon/TycoonGameOver.cs +++ b/Assets/02.Scripts/Tycoon/TycoonGameOver.cs @@ -77,6 +77,7 @@ public class TycoonGameOver : MonoBehaviour IEnumerator MoveObject() { VisualFeedbackManager.Instance.SetBaseTimeScale(0.0f); + PlayerInputKeyManager.Instance.DisableAction("Manual"); _panel.SetActive(true); // 2.0초 동안은 흔들리기만 함 float timer = 0f; diff --git a/Assets/02.Scripts/Ui/Tycoon/BalloonUi.cs b/Assets/02.Scripts/Ui/Tycoon/BalloonUi.cs index ef36174d1..5f1a9d92b 100644 --- a/Assets/02.Scripts/Ui/Tycoon/BalloonUi.cs +++ b/Assets/02.Scripts/Ui/Tycoon/BalloonUi.cs @@ -148,7 +148,7 @@ namespace BlueWater.Uis { if (_tween == null) { - Debug.LogError("게이지 리셋 오류"); + Debug.LogError("BalloonUi 게이지 리셋 오류"); return; } diff --git a/Assets/02.Scripts/Ui/Tycoon/Bill.cs b/Assets/02.Scripts/Ui/Tycoon/Bill.cs index d2e1fd4b3..10a2f62d8 100644 --- a/Assets/02.Scripts/Ui/Tycoon/Bill.cs +++ b/Assets/02.Scripts/Ui/Tycoon/Bill.cs @@ -192,7 +192,7 @@ namespace BlueWater { if (_sliderTween == null) { - Debug.LogError("게이지 리셋 오류"); + Debug.LogError("Bill 게이지 리셋 오류"); return; } diff --git a/Assets/02.Scripts/Ui/Tycoon/BillUi.cs b/Assets/02.Scripts/Ui/Tycoon/BillUi.cs index ac8b61a3b..8f8856806 100644 --- a/Assets/02.Scripts/Ui/Tycoon/BillUi.cs +++ b/Assets/02.Scripts/Ui/Tycoon/BillUi.cs @@ -54,7 +54,7 @@ namespace BlueWater.Uis { var instance = Instantiate(_billPrefab, _spawnLocation); instance.Initialize(customer, _spawnPosition, _billInfos[0].Position); - customer.CurrentBill = instance; + customer.SetCurrentBill(instance); var newKeyValuePair = new KeyValuePair(customer, instance); _customerBills.Add(newKeyValuePair); } diff --git a/Assets/02.Scripts/Ui/Tycoon/ManualBook.cs b/Assets/02.Scripts/Ui/Tycoon/ManualBook.cs index 43118a2f8..4182acac4 100644 --- a/Assets/02.Scripts/Ui/Tycoon/ManualBook.cs +++ b/Assets/02.Scripts/Ui/Tycoon/ManualBook.cs @@ -6,7 +6,6 @@ using BlueWater.Tycoons; using BlueWater.Uis; using TMPro; using UnityEngine; -using UnityEngine.Serialization; using UnityEngine.UI; public class ManualBook : SwitchActionPopupUi @@ -78,20 +77,22 @@ public class ManualBook : SwitchActionPopupUi SelectedItem(_button[0]); } - public override void Open() { - base.Open(); VisualFeedbackManager.Instance.SetBaseTimeScale(0.0f); + PlayerInputKeyManager.Instance.SwitchCurrentActionMap(SwitchMapsOpened); + PopupUiController.RegisterPopup(this); + ShowUi(); + IsOpened = true; } public override void Close() { - gameObject.SetActive(false); + HideUi(); PopupUiController.UnregisterPopup(this); - IsOpened = false; PlayerInputKeyManager.Instance.SwitchCurrentActionMap(SwitchMapsClosed); + IsOpened = false; if (!PopupUiController.IsPopupListEmpty()) return; @@ -202,9 +203,11 @@ public class ManualBook : SwitchActionPopupUi } } - private void UpdateManualBook(LevelData levelData) { Update_Cocktails(); } + + public void ShowUi() => gameObject.SetActive(true); + public void HideUi() => gameObject.SetActive(false); } diff --git a/Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs b/Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs index 3a105a33a..e4a76a73b 100644 --- a/Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs +++ b/Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs @@ -53,16 +53,17 @@ namespace BlueWater.Uis public override void Open() { - transform.SetAsLastSibling(); - ShowUi(); - PopupUiController.RegisterPopup(this); - IsOpened = true; VisualFeedbackManager.Instance.SetBaseTimeScale(0.0f); + PlayerInputKeyManager.Instance.DisableAction("Manual"); + PopupUiController.RegisterPopup(this); + ShowUi(); + IsOpened = true; } public override void Close() { HideUi(); + PlayerInputKeyManager.Instance.EnableAction("Manual"); PopupUiController.UnregisterPopup(this); IsOpened = false; diff --git a/Assets/02.Scripts/Ui/Tycoon/Upgrade_Popup.cs b/Assets/02.Scripts/Ui/Tycoon/Upgrade_Popup.cs index 1e95a926c..c4711ebed 100644 --- a/Assets/02.Scripts/Ui/Tycoon/Upgrade_Popup.cs +++ b/Assets/02.Scripts/Ui/Tycoon/Upgrade_Popup.cs @@ -28,16 +28,17 @@ public class Upgrade_Popup : PopupUi public override void Open() { - transform.SetAsLastSibling(); - ShowUi(); - PopupUiController.RegisterPopup(this); - IsOpened = true; VisualFeedbackManager.Instance.SetBaseTimeScale(0.0f); + PlayerInputKeyManager.Instance.DisableAction("Manual"); + PopupUiController.RegisterPopup(this); + ShowUi(); + IsOpened = true; } public override void Close() { HideUi(); + PlayerInputKeyManager.Instance.EnableAction("Manual"); PopupUiController.UnregisterPopup(this); IsOpened = false;