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