From 1cf7b9a48f091100c35134f050ab84fbdf92f52f Mon Sep 17 00:00:00 2001 From: NTG_Lenovo Date: Mon, 28 Oct 2024 14:09:06 +0900 Subject: [PATCH] =?UTF-8?q?0.3.2.8=20=EB=88=84=EB=9D=BD=EB=90=9C=20?= =?UTF-8?q?=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/02.Scripts/EventManager.cs | 7 +++++++ Assets/02.Scripts/Prop/Tycoon/Barrel.cs | 14 ++++++++++++++ .../Tycoon/TycoonIngredientController.cs | 9 --------- Assets/02.Scripts/Ui/Combat/PlayerHealthPointUi.cs | 2 +- Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs | 2 +- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Assets/02.Scripts/EventManager.cs b/Assets/02.Scripts/EventManager.cs index a97d91aa2..274c7be02 100644 --- a/Assets/02.Scripts/EventManager.cs +++ b/Assets/02.Scripts/EventManager.cs @@ -201,6 +201,13 @@ namespace BlueWater { OnCleaningAll?.Invoke(); } + + // 모든 배럴의 게이지 추가 + public static Action OnAddBarrels; + public static void InvokeAddBarrels(int addedValue) + { + OnAddBarrels?.Invoke(addedValue); + } #endregion } diff --git a/Assets/02.Scripts/Prop/Tycoon/Barrel.cs b/Assets/02.Scripts/Prop/Tycoon/Barrel.cs index aa891e86f..f1ea3dda9 100644 --- a/Assets/02.Scripts/Prop/Tycoon/Barrel.cs +++ b/Assets/02.Scripts/Prop/Tycoon/Barrel.cs @@ -61,12 +61,19 @@ namespace BlueWater.Tycoons protected override void Start() { base.Start(); + + EventManager.OnAddBarrels += AddCurrentAmount; _liquidImage.sprite = _isActivated ? _liquidData.Sprite : DataManager.Instance.SpriteDataSo.Lock; InteractionMessage = $"{_liquidData.Name} 따르기"; _instanceMaterial.SetColor(LiquidColorHash, _liquidData.Color * _colorIntensity); } + private void OnDestroy() + { + EventManager.OnAddBarrels -= AddCurrentAmount; + } + public override void Interaction() { OnBarrelInteracted?.Invoke(this); @@ -135,5 +142,12 @@ namespace BlueWater.Tycoons IsActivated = true; SetCurrentAmount(_liquidData.GetMaxAmount()); } + + public void AddCurrentAmount(int addedValue) + { + if (!_isActivated) return; + + SetCurrentAmount(CurrentAmount + addedValue, true); + } } } \ No newline at end of file diff --git a/Assets/02.Scripts/Tycoon/TycoonIngredientController.cs b/Assets/02.Scripts/Tycoon/TycoonIngredientController.cs index 4041d01a2..35b6901e3 100644 --- a/Assets/02.Scripts/Tycoon/TycoonIngredientController.cs +++ b/Assets/02.Scripts/Tycoon/TycoonIngredientController.cs @@ -102,14 +102,5 @@ namespace BlueWater.Tycoons { return _barrels.Where(barrel => barrel.IsActivated).ToList(); } - - public void AllAddBarrels(int addVal) - { - var activeBarrels = GetActivatedBarrels(); - foreach (var VARIABLE in activeBarrels) - { - VARIABLE.SetCurrentAmount(VARIABLE.CurrentAmount + addVal, true); - } - } } } diff --git a/Assets/02.Scripts/Ui/Combat/PlayerHealthPointUi.cs b/Assets/02.Scripts/Ui/Combat/PlayerHealthPointUi.cs index 5ecac86b4..60c996157 100644 --- a/Assets/02.Scripts/Ui/Combat/PlayerHealthPointUi.cs +++ b/Assets/02.Scripts/Ui/Combat/PlayerHealthPointUi.cs @@ -76,7 +76,7 @@ namespace BlueWater.Uis var addedMaxHealthPoint = changedMaxHealthPoint - previousMaxHealthPoint; _maxHeartCount = Mathf.CeilToInt(changedMaxHealthPoint * 0.5f); InitializeHealthPoint(); - TycoonManager.Instance.TycoonStatus.CurrentPlayerHealth += addedMaxHealthPoint * 2; + TycoonManager.Instance.TycoonStatus.CurrentPlayerHealth += addedMaxHealthPoint; } public void SetCurrentHealthPoint(int changedHealthPoint) diff --git a/Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs b/Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs index 4f8a3f00d..0f43b34f0 100644 --- a/Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs +++ b/Assets/02.Scripts/Ui/Tycoon/TycoonSelectCard.cs @@ -173,7 +173,7 @@ namespace BlueWater.Uis case "AddGarnish2": TycoonManager.Instance.TycoonStatus.CurrentGarnishAmount2 += 4000; break; case "AddAllLiquid": - TycoonManager.Instance.TycoonIngredientController.AllAddBarrels(1000); break; + EventManager.InvokeAddBarrels(1000); break; case "ServerNpc": EventManager.InvokeCreateServerCrew(); break; case "CleanerNpc":