Files
cppk-ar/Assets/Scripts/LogoHandler.cs
T
2022-12-28 13:43:10 +05:00

33 lines
796 B
C#

using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;
using UnityEngine.Events;
[RequireComponent(typeof(CanvasGroup))]
public class LogoHandler : MonoBehaviour
{
[SerializeField] private CanvasGroup logo;
[SerializeField] UnityEvent OnTimerEnded;
private CanvasGroup canvasGroup;
IEnumerator Start()
{
DontDestroyOnLoad(gameObject);
canvasGroup = GetComponent<CanvasGroup>();
yield return new WaitForSeconds(2);
logo.DOFade(0, .4f)
.OnComplete(() => canvasGroup
.DOFade(0, .8f)
.OnComplete(() =>
{
OnTimerEnded?.Invoke();
Destroy(this.gameObject);
}));
}
}