Reimplemented intro animation as regular ol' sprites

This commit is contained in:
2025-09-09 14:22:05 +02:00
parent aa127bf6d5
commit 2be6b5626e
10 changed files with 812 additions and 328 deletions

View File

@@ -1,18 +1,23 @@
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.UI;
public class IntroCinematicsPlayer : MonoBehaviour
{
public bool ShouldPlayIntro;
public GameObject introsequence;
private Image introRenderer;
private PlayableDirector director;
private Animator animation;
void OnEnable()
{
// Get the director and subscribe to when it stops playing
director = GetComponent<PlayableDirector>();
introRenderer = GetComponent<Image>();
director.stopped += OnPlayableDirectorStopped;
animation = GetComponent<Animator>();
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
@@ -20,14 +25,18 @@ public class IntroCinematicsPlayer : MonoBehaviour
//Play the intro and unhide the Canvas object if intro is enabled
if (ShouldPlayIntro)
{
introsequence.SetActive(true);
introRenderer.enabled = true;
director.Play();
animation.enabled = true;
}
;
//Disable the intro Canvas object if intro is disabled
if (!ShouldPlayIntro)
{
introsequence.SetActive(false);
director.Stop();
introRenderer.enabled = false;
animation.enabled = false;
}
;
@@ -38,7 +47,7 @@ public class IntroCinematicsPlayer : MonoBehaviour
void OnPlayableDirectorStopped(PlayableDirector aDirector)
{
// Disable the introsequence gameobject when intro is finished playing
introsequence.SetActive(false);
introRenderer.enabled = false;
}
// Update is called once per frame