using System.Collections; using BlueWater; using UnityEngine; using UnityEngine.UI; public class Upgrade_Popup : MonoBehaviour { [SerializeField] private GameObject _panel; [SerializeField] private AnimationController _animationController; private bool isReversing = false; // 애니메이션 상태를 체크할 변수 [SerializeField] private Image information; //정보를 알려주는 이미지 private void Start() { EventManager.OnUpgradeUi += StartUpgradePopup; } private void OnDestroy() { EventManager.OnUpgradeUi -= StartUpgradePopup; } private void StartUpgradePopup(LevelData currentLevelData) { StartCoroutine(StartUpgradePopupCoroutine(currentLevelData)); } // ReSharper disable Unity.PerformanceAnalysis private IEnumerator StartUpgradePopupCoroutine(LevelData currentLevelData) { ShowUi(); float timer = 0f; while (timer < 1.0f) { timer += Time.unscaledDeltaTime; yield return null; } timer = 0f; while (timer < 0.5) { timer += Time.unscaledDeltaTime; float t = timer / 0.5f; float easedT = EaseEffect.BounceOut(t); information.transform.localScale = Vector3.Lerp( new Vector3(0.0f,0.0f,0.0f), new Vector3(1.0f,1.0f,1.0f), easedT); yield return null; } timer = 0f; while (timer < 2.0) { timer += Time.unscaledDeltaTime; yield return null; } timer = 0f; while (timer < 0.5) { timer += Time.unscaledDeltaTime; float t = timer / 0.5f; float easedT = EaseEffect.BounceOut(t); information.transform.localScale = Vector3.Lerp( new Vector3(1.0f,1.0f,1.0f), new Vector3(0.0f,0.0f,0.0f), easedT); yield return null; } _animationController.PlayAnimation("CardUpgrade_Reverse"); timer = 0f; while (timer < 1.0f) { timer += Time.unscaledDeltaTime; yield return null; } VisualFeedbackManager.Instance.ResetTimeScale(); HideUi(); } public void ShowUi() => _panel.SetActive(true); public void HideUi() => _panel.SetActive(false); }