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

85 lines
2.1 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;
2024-10-28 09:09:18 +00:00
using UnityEngine.UI;
2024-10-21 05:47:20 +00:00
public class Upgrade_Popup : MonoBehaviour
{
2024-10-28 04:24:04 +00:00
[SerializeField]
private AnimationController _animationController;
private bool isReversing = false; // 애니메이션 상태를 체크할 변수
2024-10-28 09:09:18 +00:00
[SerializeField]
private Image information; //정보를 알려주는 이미지
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 09:09:18 +00:00
2024-10-28 04:24:04 +00:00
2024-10-28 09:09:18 +00:00
float timer = 0f;
while (timer < 1.0f)
2024-10-28 04:24:04 +00:00
{
2024-10-28 09:09:18 +00:00
timer += Time.unscaledDeltaTime;
yield return null;
2024-10-28 04:24:04 +00:00
}
2024-10-28 09:09:18 +00:00
timer = 0f;
2024-10-28 04:24:04 +00:00
2024-10-28 09:09:18 +00:00
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)
2024-10-28 04:24:04 +00:00
{
timer += Time.unscaledDeltaTime;
yield return null;
}
2024-10-28 09:09:18 +00:00
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;
}
2024-10-28 04:24:04 +00:00
_animationController.PlayAnimation("CardUpgrade_Reverse");
2024-10-28 09:09:18 +00:00
timer = 0f;
while (timer < 1.0f)
2024-10-28 04:24:04 +00:00
{
2024-10-28 09:09:18 +00:00
timer += Time.unscaledDeltaTime;
yield return null;
2024-10-28 04:24:04 +00:00
}
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
}