diff --git a/Assets/02.Scripts/Character/Npc/Customer/Customer.cs b/Assets/02.Scripts/Character/Npc/Customer/Customer.cs index 78ae41ca7..14c40e431 100644 --- a/Assets/02.Scripts/Character/Npc/Customer/Customer.cs +++ b/Assets/02.Scripts/Character/Npc/Customer/Customer.cs @@ -164,7 +164,12 @@ namespace BlueWater.Npcs.Customers { InitializeComponents(); } - + + private void Start() + { + EventManager.OnGaugeResetCustomers += ResetGauge; + } + private void OnApplicationQuit() { _isQuitting = true; @@ -179,6 +184,7 @@ namespace BlueWater.Npcs.Customers private void OnDestroy() { + EventManager.OnGaugeResetCustomers -= ResetGauge; EventManager.InvokeDestroyCustomer(this); } @@ -462,6 +468,14 @@ namespace BlueWater.Npcs.Customers StateMachineController.TransitionToState(WalkingState, this); } + public void ResetGauge() + { + if (!CurrentTableSeat || IsReceivedItem) return; + + BalloonUi.ResetGauge(); + CurrentBill.ResetGauge(); + } + #endregion } } \ No newline at end of file diff --git a/Assets/02.Scripts/EventManager.cs b/Assets/02.Scripts/EventManager.cs index a8df35bca..a97d91aa2 100644 --- a/Assets/02.Scripts/EventManager.cs +++ b/Assets/02.Scripts/EventManager.cs @@ -167,6 +167,13 @@ namespace BlueWater { OnOrderResult?.Invoke(orderedCustomer, orderedSucceed); } + + // 손님의 기다림 게이지를 초기화 시키는 이벤트 + public static Action OnGaugeResetCustomers; + public static void InvokeGaugeResetCustomers() + { + OnGaugeResetCustomers?.Invoke(); + } // Crews public static Func OnCreateCleanerCrew; @@ -186,6 +193,14 @@ namespace BlueWater { OnCreateBartenderCrew?.Invoke(); } + + // Props + // 레스토랑을 전부 청소 이벤트 + public static Action OnCleaningAll; + public static void InvokeCleaningAll() + { + OnCleaningAll?.Invoke(); + } #endregion } diff --git a/Assets/02.Scripts/Prop/Tycoon/TableSeat.cs b/Assets/02.Scripts/Prop/Tycoon/TableSeat.cs index 11ef10790..0589c78e6 100644 --- a/Assets/02.Scripts/Prop/Tycoon/TableSeat.cs +++ b/Assets/02.Scripts/Prop/Tycoon/TableSeat.cs @@ -53,6 +53,8 @@ namespace BlueWater.Tycoons { base.Start(); + EventManager.OnCleaningAll += Cleaning; + _fullBeerGlass = DataManager.Instance.SpriteDataSo.FullBeerGlass; _emptyBeerGlass = DataManager.Instance.SpriteDataSo.EmptyBeerGlass; } @@ -108,6 +110,11 @@ namespace BlueWater.Tycoons } } + private void OnDestroy() + { + EventManager.OnCleaningAll -= Cleaning; + } + public void Initialize() { UnreserveSeat(); @@ -186,5 +193,12 @@ namespace BlueWater.Tycoons { return !IsCleaned; } + + public void Cleaning() + { + if (IsCleaned) return; + + CleanTable(); + } } } \ 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 8c3d181ab..a0f1a34d3 100644 --- a/Assets/02.Scripts/Prop/Tycoon/Vomiting.cs +++ b/Assets/02.Scripts/Prop/Tycoon/Vomiting.cs @@ -49,12 +49,6 @@ namespace BlueWater.Tycoons if (HoldingElapsedTime > _interactionHoldingTime) { - if (_isCrewInteracting) - { - OnInteractionCompleted?.Invoke(); - OnInteractionCompleted = null; - } - Destroy(); } @@ -105,7 +99,16 @@ namespace BlueWater.Tycoons private void Destroy() { - GameManager.Instance.CurrentTycoonPlayer.IsCleaningFloor = false; + if (_isPlayerInteracting) + { + GameManager.Instance.CurrentTycoonPlayer.IsCleaningFloor = false; + } + if (_isCrewInteracting) + { + OnInteractionCompleted?.Invoke(); + OnInteractionCompleted = null; + } + Destroy(gameObject); } diff --git a/Assets/02.Scripts/Ui/Tycoon/BalloonUi.cs b/Assets/02.Scripts/Ui/Tycoon/BalloonUi.cs index 93fa81131..6240ec728 100644 --- a/Assets/02.Scripts/Ui/Tycoon/BalloonUi.cs +++ b/Assets/02.Scripts/Ui/Tycoon/BalloonUi.cs @@ -3,6 +3,7 @@ using BlueWater.Items; using BlueWater.Tycoons; using DG.Tweening; using Sirenix.OdinInspector; +using Unity.VisualScripting; using UnityEngine; using UnityEngine.UI; @@ -142,6 +143,17 @@ namespace BlueWater.Uis .OnComplete(OnTweenComplete) .SetAutoKill(false); } + + public void ResetGauge() + { + if (_tween == null) + { + Debug.LogError("게이지 리셋 오류"); + return; + } + + _tween.Restart(); + } public void PayMoney(int waitTime, int hurryTime) { diff --git a/Assets/02.Scripts/Ui/Tycoon/Bill.cs b/Assets/02.Scripts/Ui/Tycoon/Bill.cs index a3d36a44d..883843ff4 100644 --- a/Assets/02.Scripts/Ui/Tycoon/Bill.cs +++ b/Assets/02.Scripts/Ui/Tycoon/Bill.cs @@ -188,5 +188,16 @@ namespace BlueWater _checkImageObject?.gameObject.SetActive(true); _animationController?.SetAnimationParameter("isBartenderChecked", true); } + + public void ResetGauge() + { + if (_sliderTween == null) + { + Debug.LogError("게이지 리셋 오류"); + return; + } + + _sliderTween.Restart(); + } } } \ No newline at end of file diff --git a/Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs b/Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs index b5d08cb0a..4f8a3f00d 100644 --- a/Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs +++ b/Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs @@ -155,37 +155,42 @@ namespace BlueWater.Uis switch (currTycoonCard.CardDataForIdx.Idx) //탐색 후 행동... { case "HeartPlus": - TycoonManager.Instance.TycoonStatus.MaxPlayerHealth += 2 ;break; + TycoonManager.Instance.TycoonStatus.MaxPlayerHealth += 2; break; case "HeartHeal": - TycoonManager.Instance.TycoonStatus.CurrentPlayerHealth += 2 ;break; + TycoonManager.Instance.TycoonStatus.CurrentPlayerHealth += 2; break; case "HeartAllHeal": - TycoonManager.Instance.TycoonStatus.CurrentPlayerHealth = TycoonManager.Instance.TycoonStatus.MaxPlayerHealth ;break; + TycoonManager.Instance.TycoonStatus.CurrentPlayerHealth = TycoonManager.Instance.TycoonStatus.MaxPlayerHealth; break; case "AddLiquidB": - TycoonManager.Instance.TycoonStatus.CurrentLiquidAmountB += 4000;break; + TycoonManager.Instance.TycoonStatus.CurrentLiquidAmountB += 4000; break; case "AddLiquidC": - TycoonManager.Instance.TycoonStatus.CurrentLiquidAmountC += 4000;break; + TycoonManager.Instance.TycoonStatus.CurrentLiquidAmountC += 4000; break; case "AddLiquidD": - TycoonManager.Instance.TycoonStatus.CurrentLiquidAmountD += 4000;break; + TycoonManager.Instance.TycoonStatus.CurrentLiquidAmountD += 4000; break; case "AddLiquidE": - TycoonManager.Instance.TycoonStatus.CurrentLiquidAmountE += 4000;break; + TycoonManager.Instance.TycoonStatus.CurrentLiquidAmountE += 4000; break; case "AddGarnish1": - TycoonManager.Instance.TycoonStatus.CurrentGarnishAmount1 += 4000;break; + TycoonManager.Instance.TycoonStatus.CurrentGarnishAmount1 += 4000; break; case "AddGarnish2": - TycoonManager.Instance.TycoonStatus.CurrentGarnishAmount2 += 4000;break; + TycoonManager.Instance.TycoonStatus.CurrentGarnishAmount2 += 4000; break; case "AddAllLiquid": TycoonManager.Instance.TycoonIngredientController.AllAddBarrels(1000); break; - case "ServerNpc": EventManager.InvokeCreateServerCrew(); break; - case "CleanerNpc": EventManager.InvokeCreateCleanerCrew(); break; - case "ChefNpc": EventManager.InvokeCreateBartenderCrew(); break; + case "ServerNpc": + EventManager.InvokeCreateServerCrew(); break; + case "CleanerNpc": + EventManager.InvokeCreateCleanerCrew(); break; + case "ChefNpc": + EventManager.InvokeCreateBartenderCrew(); break; case "SpeedUp": TycoonManager.Instance.TycoonStatus.PlayerMoveSpeedMultiplier += 0.05f; break; case "ExpGetUp": TycoonManager.Instance.TycoonStatus.ExpMultiplier += 0.2f; break; - case "GoldGetUp": + case "GoldGetUp": TycoonManager.Instance.TycoonStatus.GoldMultiplier += 0.2f; break; - // case "CleanUp": return; break; - // case "GaugeReset": return; break; - default: Debug.Log("Not Found Card : IDX" + currTycoonCard.CardDataForIdx.Idx); return; break; + case "CleanUp": + EventManager.InvokeCleaningAll(); break; + case "GaugeReset": + EventManager.InvokeGaugeResetCustomers(); break; + default: Debug.Log("Not Found Card : IDX" + currTycoonCard.CardDataForIdx.Idx); return; } TycoonManager.Instance.CardDataSo.AddToSelectedCard(currTycoonCard.CardDataForIdx);