2024-02-03 00:34:11 +01:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
2024-02-03 18:02:20 +01:00
|
|
|
using UnityEngine.SceneManagement;
|
2024-02-03 00:34:11 +01:00
|
|
|
|
|
|
|
public class MainMenuTransitionAnimation : MonoBehaviour
|
|
|
|
{
|
|
|
|
Animator animator;
|
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
animator = GetComponent<Animator>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void AnimationMainMenuStart()
|
|
|
|
{
|
|
|
|
animator.SetTrigger("Start");
|
2024-02-03 18:02:20 +01:00
|
|
|
|
|
|
|
StartCoroutine(WaitBeforeSceneChange());
|
|
|
|
}
|
|
|
|
|
|
|
|
private IEnumerator WaitBeforeSceneChange()
|
|
|
|
{
|
|
|
|
var animInfo = animator.GetCurrentAnimatorStateInfo(0);
|
|
|
|
while (!(animInfo.normalizedTime >= 0.99f && animInfo.IsName("MenuTransition")))
|
|
|
|
{
|
|
|
|
animInfo = animator.GetCurrentAnimatorStateInfo(0);
|
|
|
|
yield return new WaitForSecondsRealtime(0.1f);
|
|
|
|
}
|
|
|
|
|
2024-02-04 08:40:08 +01:00
|
|
|
AudioManager.StopAllAudio();
|
2024-02-03 18:02:20 +01:00
|
|
|
SceneManager.LoadScene(1);
|
2024-02-04 08:40:08 +01:00
|
|
|
//SceneManager.sceneLoaded += () => AudioManager.stop
|
2024-02-03 00:34:11 +01:00
|
|
|
}
|
|
|
|
}
|