diff --git a/Assets/01.Scenes/01.Tycoon.unity b/Assets/01.Scenes/01.Tycoon.unity index 214b775aa..701df8fa3 100644 --- a/Assets/01.Scenes/01.Tycoon.unity +++ b/Assets/01.Scenes/01.Tycoon.unity @@ -10365,7 +10365,7 @@ MonoBehaviour: m_EditorClassIdentifier: _persistent: 0 k__BackingField: {fileID: 873223991} - k__BackingField: {fileID: 0} + k__BackingField: {fileID: 1355183327} k__BackingField: {fileID: 1985878519} cameraLocation: {fileID: 1634548838} k__BackingField: {fileID: 545850352} diff --git a/Assets/02.Scripts/Character/Npc/Crew/Bartender/BartenderCrew.cs b/Assets/02.Scripts/Character/Npc/Crew/Bartender/BartenderCrew.cs index feed04da3..5174f0a5a 100644 --- a/Assets/02.Scripts/Character/Npc/Crew/Bartender/BartenderCrew.cs +++ b/Assets/02.Scripts/Character/Npc/Crew/Bartender/BartenderCrew.cs @@ -55,7 +55,7 @@ namespace BlueWater.Npcs.Crews.Bartender public void MakingCocktail() { - OrderedCustomer.CurrentBill.BartenderMakingCocktail(); + OrderedCustomer.CurrentBill?.BartenderMakingCocktail(); BalloonUi.OrderItem(OrderedCustomer.OrderedCocktailData.Idx, 0, 15); IsMakingCocktail = true; @@ -63,10 +63,7 @@ namespace BlueWater.Npcs.Crews.Bartender public void CompletedMakingCocktail() { - if (OrderedCustomer.CurrentBill) - { - OrderedCustomer.CurrentBill.BartenderCompleteMakingCocktail(); - } + OrderedCustomer.CurrentBill?.BartenderCompleteMakingCocktail(); BalloonUi.DiscardItem(); MyBartenderTable.CompleteMakingCocktail(OrderedCustomer.OrderedCocktailData); IsMakingCocktail = false; diff --git a/Assets/02.Scripts/Ui/Tycoon/Bill.cs b/Assets/02.Scripts/Ui/Tycoon/Bill.cs index 883843ff4..788298de1 100644 --- a/Assets/02.Scripts/Ui/Tycoon/Bill.cs +++ b/Assets/02.Scripts/Ui/Tycoon/Bill.cs @@ -50,6 +50,8 @@ namespace BlueWater public BillInfo CurrentBillInfo { get; private set; } private Tween _sliderTween; + private Sequence _moveSequence; + private Sequence _arrivedSequence; private Vector3 _spawnPosition; private float _maxDistance; @@ -74,7 +76,6 @@ namespace BlueWater public void SetTween(int waitTime, int hurryTime) { - _sliderTween?.Kill(); _sliderTween = _slider.DOValue(0f, hurryTime) .From(1f) .SetEase(Ease.Linear) @@ -85,7 +86,8 @@ namespace BlueWater private void OnDestroy() { _slider.onValueChanged.RemoveListener(OnSliderValueChanged); - DOTween.Kill(_rect); + _moveSequence.Kill(); + _arrivedSequence.Kill(); } private void OnSliderValueChanged(float value) @@ -95,8 +97,6 @@ namespace BlueWater public void Move(BillInfo billInfo) { - if (!_rect) return; - if (CurrentBillInfo != null) { CurrentBillInfo.IsEmpty = true; @@ -111,27 +111,26 @@ namespace BlueWater var rotationAngle = Mathf.Lerp(8f, 40f, distance / _maxDistance); var punchStrength = Mathf.Lerp(1f, 5f, distance / _maxDistance); - var moveSequence = DOTween.Sequence().SetAutoKill(true); - moveSequence.Append(_rect.DOLocalMoveX(CurrentBillInfo.Position.x, moveTime)); - moveSequence.Join(_rect.DOLocalRotate(new Vector3(0, 0, rotationAngle), moveTime / 5f)); - moveSequence.Join(_rect.DOPunchRotation(new Vector3(0f, 0f, punchStrength), moveTime * 4f / 5f, 3, 0.2f) + _moveSequence = DOTween.Sequence().SetAutoKill(true); + _moveSequence.Append(_rect.DOLocalMoveX(CurrentBillInfo.Position.x, moveTime)); + _moveSequence.Join(_rect.DOLocalRotate(new Vector3(0, 0, rotationAngle), moveTime / 5f)); + _moveSequence.Join(_rect.DOPunchRotation(new Vector3(0f, 0f, punchStrength), moveTime * 4f / 5f, 3, 0.2f) .SetDelay(0.2f) .SetEase(Ease.InOutBounce)); - moveSequence.AppendCallback(OnArrivedTarget); + _moveSequence.AppendCallback(OnArrivedTarget); } private void OnArrivedTarget() { - if (!_rect) return; + if (!gameObject || !_rect) return; CurrentBillInfo.IsMoving = false; var randomZ = Random.Range(-15f, 15f); - var arrivedSequence = DOTween.Sequence(); - - arrivedSequence.Append(_rect.DOLocalRotate(Vector3.zero, 0.2f).SetEase(Ease.InQuad)); - arrivedSequence.Append(_rect.DOPunchRotation(new Vector3(0f, 0f, -20f), 1f, 5, 0.5f) + _arrivedSequence = DOTween.Sequence(); + _arrivedSequence.Append(_rect.DOLocalRotate(Vector3.zero, 0.2f).SetEase(Ease.InQuad)); + _arrivedSequence.Append(_rect.DOPunchRotation(new Vector3(0f, 0f, -20f), 1f, 5, 0.5f) .SetEase(Ease.InOutBounce)); - arrivedSequence.Append(_rect.DOLocalRotate(new Vector3(0f, 0f, randomZ), 0.2f).SetEase(Ease.InQuad)); + _arrivedSequence.Append(_rect.DOLocalRotate(new Vector3(0f, 0f, randomZ), 0.2f).SetEase(Ease.InQuad)); } public void OrderResult(bool isSucceed, Action onDestroyAction) @@ -154,7 +153,7 @@ namespace BlueWater } _stampImageObject.SetActive(true); - _sliderTween.Kill(); + _sliderTween?.Kill(); var isTrigger = false; while (_animationController.IsComparingCurrentAnimation(animationName) && _animationController.GetCurrentAnimationNormalizedTime() < 1f) @@ -179,14 +178,18 @@ namespace BlueWater public void BartenderMakingCocktail() { - _makingCocktailPivotObject?.gameObject.SetActive(true); + if (!gameObject) return; + + _makingCocktailPivotObject.gameObject.SetActive(true); } public void BartenderCompleteMakingCocktail() { - _makingCocktailPivotObject?.gameObject.SetActive(false); - _checkImageObject?.gameObject.SetActive(true); - _animationController?.SetAnimationParameter("isBartenderChecked", true); + if (!gameObject) return; + + _makingCocktailPivotObject.gameObject.SetActive(false); + _checkImageObject.gameObject.SetActive(true); + _animationController.SetAnimationParameter("isBartenderChecked", true); } public void ResetGauge() diff --git a/Assets/02.Scripts/Ui/Tycoon/ManualBook.cs b/Assets/02.Scripts/Ui/Tycoon/ManualBook.cs index cee188e68..4889bddd9 100644 --- a/Assets/02.Scripts/Ui/Tycoon/ManualBook.cs +++ b/Assets/02.Scripts/Ui/Tycoon/ManualBook.cs @@ -121,12 +121,12 @@ public class ManualBook : SwitchActionPopupUi foreach (var element2 in element.ValidIngredients) //들어가는 리큐르, 가니쉬 종류 { if (element2.Idx.Equals("LiquidA")) {createCocktailMenu.LiquidA = element2.Ratio; createCocktailMenu.Sibling -= 1; }; - if (element2.Idx.Equals("LiquidB")) {createCocktailMenu.LiquidB = element2.Amount; createCocktailMenu.Sibling -= 2; }; - if (element2.Idx.Equals("LiquidC")) {createCocktailMenu.LiquidC = element2.Amount; createCocktailMenu.Sibling -= 4; }; - if (element2.Idx.Equals("LiquidD")) {createCocktailMenu.LiquidD = element2.Amount; createCocktailMenu.Sibling -= 8; }; - if (element2.Idx.Equals("LiquidE")) {createCocktailMenu.LiquidE = element2.Amount; createCocktailMenu.Sibling -= 16; }; - if (element2.Idx.Equals("Garnish1")) {createCocktailMenu.Garnish1 = element2.Amount; createCocktailMenu.Sibling -= 32; }; - if (element2.Idx.Equals("Garnish2")) {createCocktailMenu.Garnish2 = element2.Amount; createCocktailMenu.Sibling -= 64; }; + if (element2.Idx.Equals("LiquidB")) {createCocktailMenu.LiquidB = element2.Ratio; createCocktailMenu.Sibling -= 2; }; + if (element2.Idx.Equals("LiquidC")) {createCocktailMenu.LiquidC = element2.Ratio; createCocktailMenu.Sibling -= 4; }; + if (element2.Idx.Equals("LiquidD")) {createCocktailMenu.LiquidD = element2.Ratio; createCocktailMenu.Sibling -= 8; }; + if (element2.Idx.Equals("LiquidE")) {createCocktailMenu.LiquidE = element2.Ratio; createCocktailMenu.Sibling -= 16; }; + if (element2.Idx.Equals("Garnish1")) {createCocktailMenu.Garnish1 = element2.Ratio; createCocktailMenu.Sibling -= 32; }; + if (element2.Idx.Equals("Garnish2")) {createCocktailMenu.Garnish2 = element2.Ratio; createCocktailMenu.Sibling -= 64; }; } _cocktailsBtn.Add(element.Idx,createCocktailMenu);