using UnityEngine; [DefaultExecutionOrder(50)] public class PlaybackController : MonoBehaviour { private Component[] years; // Change Cameras public Camera cam1; public Camera cam2; private void Start() { cam1.enabled = true; cam2.enabled = false; years = gameObject.GetComponentsInChildren(); foreach(var year in years) { year.GetComponent().rewind = false; year.GetComponent().pause = false; year.GetComponent().play = false; } } public void OnRewindPress() { foreach (var year in years) { if (!year.GetComponent().rewind) { year.GetComponent().rewind = true; year.GetComponent().pause = false; year.GetComponent().play = false; } } } public void OnPausePress() { foreach (var year in years) { if (!year.GetComponent().pause) { year.GetComponent().rewind = false; year.GetComponent().pause = true; year.GetComponent().play = false; } } } public void OnPlayPress() { foreach (var year in years) { if (!year.GetComponent().play) { year.GetComponent().rewind = false; year.GetComponent().pause = false; year.GetComponent().play = true; } } } public void OnValueChanged(float value) { // This Method is not needed, bc the value is taken from the slider directly. } public void OnChangeViewClicked() { cam1.enabled = !cam1.enabled; cam2.enabled = !cam2.enabled; } }