2023-07-28 11:48:57 +03:00
|
|
|
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()
|
|
|
|
{
|
2023-08-01 11:28:14 +03:00
|
|
|
_shipMoveSides = FindObjectOfType<ShipPathFollower>().GetComponent<ShipMoveSides>();
|
2023-07-28 11:48:57 +03:00
|
|
|
_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);
|
|
|
|
}
|
|
|
|
}
|