Touch-up some warnings in IntroCinematicsPlayer
This commit is contained in:
@@ -1,41 +1,42 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class IntroCinematicsPlayer : MonoBehaviour
|
||||
{
|
||||
public bool ShouldPlayIntro;
|
||||
private Image introRenderer;
|
||||
private PlayableDirector director;
|
||||
[FormerlySerializedAs("ShouldPlayIntro")] public bool shouldPlayIntro;
|
||||
private Image _introRenderer;
|
||||
private PlayableDirector _director;
|
||||
|
||||
private Animator animation;
|
||||
private Animator _animatorComponent;
|
||||
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
// Get the director and subscribe to when it stops playing
|
||||
director = GetComponent<PlayableDirector>();
|
||||
introRenderer = GetComponent<Image>();
|
||||
director.stopped += OnPlayableDirectorStopped;
|
||||
animation = GetComponent<Animator>();
|
||||
_director = GetComponent<PlayableDirector>();
|
||||
_introRenderer = GetComponent<Image>();
|
||||
_director.stopped += OnPlayableDirectorStopped;
|
||||
_animatorComponent = GetComponent<Animator>();
|
||||
}
|
||||
// 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)
|
||||
if (shouldPlayIntro)
|
||||
{
|
||||
introRenderer.enabled = true;
|
||||
director.Play();
|
||||
animation.enabled = true;
|
||||
_introRenderer.enabled = true;
|
||||
_director.Play();
|
||||
_animatorComponent.enabled = true;
|
||||
}
|
||||
;
|
||||
//Disable the intro Canvas object if intro is disabled
|
||||
if (!ShouldPlayIntro)
|
||||
if (!shouldPlayIntro)
|
||||
{
|
||||
director.Stop();
|
||||
introRenderer.enabled = false;
|
||||
animation.enabled = false;
|
||||
_director.Stop();
|
||||
_introRenderer.enabled = false;
|
||||
_animatorComponent.enabled = false;
|
||||
|
||||
|
||||
}
|
||||
@@ -47,7 +48,7 @@ public class IntroCinematicsPlayer : MonoBehaviour
|
||||
void OnPlayableDirectorStopped(PlayableDirector aDirector)
|
||||
{
|
||||
// Disable the introsequence gameobject when intro is finished playing
|
||||
introRenderer.enabled = false;
|
||||
_introRenderer.enabled = false;
|
||||
|
||||
}
|
||||
// Update is called once per frame
|
||||
|
||||
Reference in New Issue
Block a user