39 lines
998 B
C#
39 lines
998 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.Playables;
|
||
|
|
||
|
public class CutsceneController : MonoBehaviour
|
||
|
{
|
||
|
private ShipMoveSides _shipMoveSides;
|
||
|
private PreviewModule _previewModule;
|
||
|
|
||
|
|
||
|
[Header("Cutscene Settings")]
|
||
|
[SerializeField]
|
||
|
public PlayableDirector _cutscene;
|
||
|
[SerializeField]
|
||
|
private float _cutsceneAfterDelay = 1.4f;
|
||
|
|
||
|
private void Awake()
|
||
|
{
|
||
|
_shipMoveSides = FindObjectOfType<ShipMoveSides>();
|
||
|
_previewModule = FindObjectOfType<PreviewModule>();
|
||
|
}
|
||
|
|
||
|
public void ShowCutscene()
|
||
|
{
|
||
|
StartCoroutine(CutsceneCoroutine());
|
||
|
}
|
||
|
|
||
|
private IEnumerator CutsceneCoroutine()
|
||
|
{
|
||
|
_shipMoveSides.ToggleInput(false);
|
||
|
_previewModule.TogglePanel(true);
|
||
|
_cutscene.Play();
|
||
|
yield return new WaitForSeconds((float)_cutscene.duration + _cutsceneAfterDelay);
|
||
|
_shipMoveSides.ToggleInput(true);
|
||
|
_previewModule.TogglePanel(false);
|
||
|
}
|
||
|
}
|