using UnityEngine; namespace R0bbie.Timeline { public class StepTimelineManager : MonoBehaviour { public static StepTimeline activeStepTimeline; public static StepController activeController; public static Step lastPlayedStep; static Step pausedOnStep; public static void ClearState() { activeStepTimeline = null; activeController = null; lastPlayedStep = null; pausedOnStep = null; } public static bool WasLastStepOnTimeline() { if (lastPlayedStep && lastPlayedStep.attachedStepTimeline) return true; else return false; } /// /// Pause all commands on the currently active timeline or controller (if one is active) /// public static void PauseCommands() { if (lastPlayedStep && lastPlayedStep.isActive) { if (lastPlayedStep.attachedStepTimeline) lastPlayedStep.attachedStepTimeline.Pause(); else if (lastPlayedStep.attachedController) lastPlayedStep.attachedController.Pause(); pausedOnStep = lastPlayedStep; } } /// /// Resume all commands on the currently active timeline or controller (if one was active when game was paused) /// public static void ResumeCommands(float _elapsedTime) { // Resume if (pausedOnStep) { if (pausedOnStep.attachedStepTimeline) pausedOnStep.attachedStepTimeline.Resume(_elapsedTime); else if (pausedOnStep.attachedController) pausedOnStep.attachedController.Resume(_elapsedTime); } } } }