CapersProject/Assets/02.Scripts/Ui/Tycoon/Upgrade_Popup.cs

50 lines
1.4 KiB
C#
Raw Normal View History

2024-10-28 04:24:04 +00:00
using System.Collections;
using BlueWater;
2024-10-21 05:47:20 +00:00
using UnityEngine;
public class Upgrade_Popup : MonoBehaviour
{
2024-10-28 04:24:04 +00:00
[SerializeField]
private AnimationController _animationController;
private bool isReversing = false; // 애니메이션 상태를 체크할 변수
2024-10-21 05:47:20 +00:00
// Start is called once before the first execution of Update after the MonoBehaviour is created
2024-10-28 04:24:04 +00:00
void OnEnable()
2024-10-21 05:47:20 +00:00
{
2024-10-28 04:24:04 +00:00
StartCoroutine(StartUpgradePopup());
2024-10-21 05:47:20 +00:00
}
2024-10-28 04:24:04 +00:00
// ReSharper disable Unity.PerformanceAnalysis
private IEnumerator StartUpgradePopup()
2024-10-21 05:47:20 +00:00
{
2024-10-28 04:24:04 +00:00
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());
}
2024-10-21 05:47:20 +00:00
2024-10-28 04:24:04 +00:00
VisualFeedbackManager.Instance.ResetTimeScale();
gameObject.SetActive(false);
2024-10-21 05:47:20 +00:00
}
2024-10-28 04:24:04 +00:00
2024-10-21 05:47:20 +00:00
}