Intro cinematic implementation and Apple Hills map
This commit is contained in:
49
Assets/Scripts/UI/IntroCinematicsPlayer.cs
Normal file
49
Assets/Scripts/UI/IntroCinematicsPlayer.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
public class IntroCinematicsPlayer : MonoBehaviour
|
||||
{
|
||||
public bool ShouldPlayIntro;
|
||||
public GameObject introsequence;
|
||||
private PlayableDirector director;
|
||||
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
// Get the director and subscribe to when it stops playing
|
||||
director = GetComponent<PlayableDirector>();
|
||||
director.stopped += OnPlayableDirectorStopped;
|
||||
}
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
//Play the intro and unhide the Canvas object if intro is enabled
|
||||
if (ShouldPlayIntro)
|
||||
{
|
||||
introsequence.SetActive(true);
|
||||
director.Play();
|
||||
}
|
||||
;
|
||||
//Disable the intro Canvas object if intro is disabled
|
||||
if (!ShouldPlayIntro)
|
||||
{
|
||||
introsequence.SetActive(false);
|
||||
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
|
||||
}
|
||||
void OnPlayableDirectorStopped(PlayableDirector aDirector)
|
||||
{
|
||||
// Disable the introsequence gameobject when intro is finished playing
|
||||
introsequence.SetActive(false);
|
||||
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/IntroCinematicsPlayer.cs.meta
Normal file
2
Assets/Scripts/UI/IntroCinematicsPlayer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c119ffb87b2a16d4f925ff5d5ffd7092
|
||||
Reference in New Issue
Block a user