CapersProject/Assets/02.Scripts/Ui/Tycoon/Upgrade_Popup.cs
2024-10-28 13:24:04 +09:00

50 lines
1.4 KiB
C#

using System.Collections;
using BlueWater;
using UnityEngine;
public class Upgrade_Popup : MonoBehaviour
{
[SerializeField]
private AnimationController _animationController;
private bool isReversing = false; // 애니메이션 상태를 체크할 변수
// Start is called once before the first execution of Update after the MonoBehaviour is created
void OnEnable()
{
StartCoroutine(StartUpgradePopup());
}
// ReSharper disable Unity.PerformanceAnalysis
private IEnumerator StartUpgradePopup()
{
float normalizedTime = _animationController.GetCurrentAnimationNormalizedTime();
Debug.Log(normalizedTime);
if (normalizedTime >= 1f)
{
yield return new WaitForSeconds(_animationController.GetCurrentAnimationLength());
}
float timer = 0f;
while (timer < 3.0)
{
timer += Time.unscaledDeltaTime;
yield return null;
}
_animationController.PlayAnimation("CardUpgrade_Reverse");
normalizedTime = _animationController.GetCurrentAnimationNormalizedTime();
Debug.Log(normalizedTime);
if (normalizedTime >= 1f)
{
yield return new WaitForSeconds(_animationController.GetCurrentAnimationLength());
}
VisualFeedbackManager.Instance.ResetTimeScale();
gameObject.SetActive(false);
}
}