using System; using Sirenix.OdinInspector; using UnityEngine; namespace BlueWater.Tycoons { [Serializable] public class TycoonStatus { [SerializeField] private int _maxPlayerHealth; public int MaxPlayerHealth { get { _maxPlayerHealth = GameManager.Instance.CurrentTycoonPlayer.PlayerHealthPoint.MaxHealthPoint; return _maxPlayerHealth; } set { _maxPlayerHealth = value; GameManager.Instance.CurrentTycoonPlayer.PlayerHealthPoint.SetMaxHealthPoint(value); } } [SerializeField] private int _currentPlayerHealth; public int CurrentPlayerHealth { get { _currentPlayerHealth = GameManager.Instance.CurrentTycoonPlayer.PlayerHealthPoint.CurrentHealthPoint; return _currentPlayerHealth; } set { _currentPlayerHealth = value; GameManager.Instance.CurrentTycoonPlayer.PlayerHealthPoint.SetCurrentHealthPoint(value); } } [SerializeField] private float _playerMoveSpeedMultiplier; public float PlayerMoveSpeedMultiplier { get { _playerMoveSpeedMultiplier = GameManager.Instance.CurrentTycoonPlayer.TycoonMovement.MoveSpeedMultiplier; return _playerMoveSpeedMultiplier; } set { _playerMoveSpeedMultiplier = value; GameManager.Instance.CurrentTycoonPlayer.TycoonMovement.SetMoveSpeedMultiplier(value); } } // 보류 [SerializeField] private int _currentExp; public int CurrentExp { get { return _currentExp; } set { _currentExp = value; } } // 보류 [SerializeField] private int _currentGold; [Title("원액")] [SerializeField] private int _currentLiquidAmountA; public int CurrentLiquidAmountA { get { _currentLiquidAmountA = TycoonManager.Instance.TycoonIngredientController.LiquidBarrelA.CurrentAmount; return _currentLiquidAmountA; } set { _currentLiquidAmountA = value; TycoonManager.Instance.TycoonIngredientController.LiquidBarrelA.SetCurrentAmount(value, true); } } [SerializeField] private int _currentLiquidAmountB; public int CurrentLiquidAmountB { get { _currentLiquidAmountB = TycoonManager.Instance.TycoonIngredientController.LiquidBarrelB.CurrentAmount; return _currentLiquidAmountB; } set { _currentLiquidAmountB = value; TycoonManager.Instance.TycoonIngredientController.LiquidBarrelB.SetCurrentAmount(value, true); } } [SerializeField] private int _currentLiquidAmountC; public int CurrentLiquidAmountC { get { _currentLiquidAmountC = TycoonManager.Instance.TycoonIngredientController.LiquidBarrelC.CurrentAmount; return _currentLiquidAmountC; } set { _currentLiquidAmountC = value; TycoonManager.Instance.TycoonIngredientController.LiquidBarrelC.SetCurrentAmount(value, true); } } [SerializeField] private int _currentLiquidAmountD; public int CurrentLiquidAmountD { get { _currentLiquidAmountD = TycoonManager.Instance.TycoonIngredientController.LiquidBarrelD.CurrentAmount; return _currentLiquidAmountD; } set { _currentLiquidAmountD = value; TycoonManager.Instance.TycoonIngredientController.LiquidBarrelD.SetCurrentAmount(value, true); } } [SerializeField] private int _currentLiquidAmountE; public int CurrentLiquidAmountE { get { _currentLiquidAmountE = TycoonManager.Instance.TycoonIngredientController.LiquidBarrelE.CurrentAmount; return _currentLiquidAmountE; } set { _currentLiquidAmountE = value; TycoonManager.Instance.TycoonIngredientController.LiquidBarrelE.SetCurrentAmount(value, true); } } [Title("가니쉬")] [SerializeField] private int _currentGarnishAmount1; public int CurrentGarnishAmount1 { get { _currentGarnishAmount1 = TycoonManager.Instance.TycoonIngredientController.GarnishBarrel1.CurrentAmount; return _currentGarnishAmount1; } set { _currentGarnishAmount1 = value; TycoonManager.Instance.TycoonIngredientController.GarnishBarrel1.SetCurrentAmount(value, true); } } [SerializeField] private int _currentGarnishAmount2; public int CurrentGarnishAmount2 { get { _currentGarnishAmount2 = TycoonManager.Instance.TycoonIngredientController.GarnishBarrel2.CurrentAmount; return _currentGarnishAmount2; } set { _currentGarnishAmount2 = value; TycoonManager.Instance.TycoonIngredientController.GarnishBarrel2.SetCurrentAmount(value, true); } } public void Initialize() { MaxPlayerHealth = GameManager.Instance.CurrentTycoonPlayer.PlayerHealthPoint.MaxHealthPoint; CurrentPlayerHealth = GameManager.Instance.CurrentTycoonPlayer.PlayerHealthPoint.CurrentHealthPoint; PlayerMoveSpeedMultiplier = GameManager.Instance.CurrentTycoonPlayer.TycoonMovement.MoveSpeedMultiplier; var ingredientController = TycoonManager.Instance.TycoonIngredientController; ingredientController.LiquidBarrelA.OnAmountChanged += UpdateLiquidA; ingredientController.LiquidBarrelB.OnAmountChanged += UpdateLiquidB; ingredientController.LiquidBarrelC.OnAmountChanged += UpdateLiquidC; ingredientController.LiquidBarrelD.OnAmountChanged += UpdateLiquidD; ingredientController.LiquidBarrelE.OnAmountChanged += UpdateLiquidE; } private void OnDestroy() { var ingredientController = TycoonManager.Instance.TycoonIngredientController; if (ingredientController != null) { ingredientController.LiquidBarrelA.OnAmountChanged -= UpdateLiquidA; ingredientController.LiquidBarrelB.OnAmountChanged -= UpdateLiquidB; ingredientController.LiquidBarrelC.OnAmountChanged -= UpdateLiquidC; ingredientController.LiquidBarrelD.OnAmountChanged -= UpdateLiquidD; ingredientController.LiquidBarrelE.OnAmountChanged -= UpdateLiquidE; } } private void UpdateLiquidA(int amount) => CurrentLiquidAmountA = amount; private void UpdateLiquidB(int amount) => CurrentLiquidAmountB = amount; private void UpdateLiquidC(int amount) => CurrentLiquidAmountC = amount; private void UpdateLiquidD(int amount) => CurrentLiquidAmountD = amount; private void UpdateLiquidE(int amount) => CurrentLiquidAmountE = amount; } }