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-10-30 17:26:19 +03:00
|
|
|
_shipMoveSides = FindObjectOfType<PlayerInputHandler>().GetComponent<ShipMoveSides>();
|
2023-07-28 11:48:57 +03:00
|
|
|
_previewModule = FindObjectOfType<PreviewModule>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ShowCutscene()
|
|
|
|
{
|
|
|
|
StartCoroutine(CutsceneCoroutine());
|
|
|
|
}
|
|
|
|
|
|
|
|
private IEnumerator CutsceneCoroutine()
|
|
|
|
{
|
2023-10-30 17:26:19 +03:00
|
|
|
Debug.Log("Cutscene Coroutine");
|
2023-07-28 11:48:57 +03:00
|
|
|
_shipMoveSides.ToggleInput(false);
|
|
|
|
_previewModule.TogglePanel(true);
|
|
|
|
_cutscene.Play();
|
|
|
|
yield return new WaitForSeconds((float)_cutscene.duration + _cutsceneAfterDelay);
|
|
|
|
_shipMoveSides.ToggleInput(true);
|
|
|
|
_previewModule.TogglePanel(false);
|
|
|
|
}
|
|
|
|
}
|