MainMenu transition change scene
This commit is contained in:
parent
a43b040676
commit
9620498dab
|
@ -20,7 +20,7 @@ AnimatorStateTransition:
|
||||||
m_TransitionDuration: 0.25
|
m_TransitionDuration: 0.25
|
||||||
m_TransitionOffset: 0
|
m_TransitionOffset: 0
|
||||||
m_ExitTime: 0.75
|
m_ExitTime: 0.75
|
||||||
m_HasExitTime: 1
|
m_HasExitTime: 0
|
||||||
m_HasFixedDuration: 1
|
m_HasFixedDuration: 1
|
||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
m_OrderedInterruption: 1
|
m_OrderedInterruption: 1
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
public class MainMenuTransitionAnimation : MonoBehaviour
|
public class MainMenuTransitionAnimation : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
@ -13,5 +14,20 @@ public class MainMenuTransitionAnimation : MonoBehaviour
|
||||||
public void AnimationMainMenuStart()
|
public void AnimationMainMenuStart()
|
||||||
{
|
{
|
||||||
animator.SetTrigger("Start");
|
animator.SetTrigger("Start");
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SceneManager.LoadScene(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,9 @@ EditorBuildSettings:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Scenes:
|
m_Scenes:
|
||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/Scenes/SampleScene.unity
|
path: Assets/Scenes/MainMenu.unity
|
||||||
guid: 8c9cfa26abfee488c85f1582747f6a02
|
guid: 33b308b02cb61b643b15ad93698b00ee
|
||||||
|
- enabled: 1
|
||||||
|
path: Assets/Scenes/Bloody Mary.unity
|
||||||
|
guid: dbc458177844bf1ceae76a97e08d3140
|
||||||
m_configObjects: {}
|
m_configObjects: {}
|
||||||
|
|
Loading…
Reference in New Issue