Made intro timeline, added it to cementfactory
This commit is contained in:
36
Assets/Scripts/Cinematics/LevelIntroDirector.cs
Normal file
36
Assets/Scripts/Cinematics/LevelIntroDirector.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using UnityEngine;
|
||||
using Core;
|
||||
using Core.Lifecycle;
|
||||
using UnityEngine.Playables;
|
||||
using Input;
|
||||
|
||||
public class LevelIntroDirector : ManagedBehaviour
|
||||
{
|
||||
public bool playOnSceneReady;
|
||||
|
||||
[HideInInspector]
|
||||
public PlayableDirector introPlayableDirector;
|
||||
|
||||
internal override void OnSceneReady()
|
||||
{
|
||||
base.OnSceneReady();
|
||||
introPlayableDirector = GetComponent<PlayableDirector>();
|
||||
introPlayableDirector.stopped += IntroTimelineStopped;
|
||||
if (playOnSceneReady)
|
||||
{
|
||||
PlayIntroTimeline();
|
||||
}
|
||||
}
|
||||
|
||||
private void IntroTimelineStopped(PlayableDirector director)
|
||||
{
|
||||
InputManager.Instance.SetInputMode(InputMode.Game);
|
||||
}
|
||||
|
||||
public void PlayIntroTimeline()
|
||||
{
|
||||
introPlayableDirector.Play();
|
||||
InputManager.Instance.SetInputMode(InputMode.InputDisabled);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user