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

85 lines
2.1 KiB
C#

using System.Collections;
using BlueWater;
using UnityEngine;
using UnityEngine.UI;
public class Upgrade_Popup : MonoBehaviour
{
[SerializeField]
private AnimationController _animationController;
private bool isReversing = false; // 애니메이션 상태를 체크할 변수
[SerializeField]
private Image information; //정보를 알려주는 이미지
// 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 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();
gameObject.SetActive(false);
}
}