42 lines
1.0 KiB
C#
42 lines
1.0 KiB
C#
using UnityEngine;
|
|
using Core;
|
|
using Core.Lifecycle;
|
|
using UnityEngine.Playables;
|
|
using Input;
|
|
using Unity.Cinemachine;
|
|
|
|
public class LevelIntroDirector : ManagedBehaviour
|
|
{
|
|
public bool playOnSceneReady;
|
|
|
|
[HideInInspector]
|
|
public PlayableDirector introPlayableDirector;
|
|
|
|
internal override void OnSceneReady()
|
|
{
|
|
base.OnSceneReady();
|
|
if (playOnSceneReady)
|
|
{
|
|
introPlayableDirector = GetComponent<PlayableDirector>();
|
|
introPlayableDirector.stopped += IntroTimelineStopped;
|
|
PlayIntroTimeline();
|
|
}
|
|
else { gameObject.SetActive(false); }
|
|
}
|
|
|
|
private void IntroTimelineStopped(PlayableDirector director)
|
|
{
|
|
InputManager.Instance.SetInputMode(InputMode.Game);
|
|
introPlayableDirector.stopped -= IntroTimelineStopped;
|
|
gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
public void PlayIntroTimeline()
|
|
{
|
|
introPlayableDirector.Play();
|
|
InputManager.Instance.SetInputMode(InputMode.InputDisabled);
|
|
}
|
|
|
|
}
|