66 lines
1.9 KiB
C#
66 lines
1.9 KiB
C#
|
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;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Pause all commands on the currently active timeline or controller (if one is active)
|
|||
|
/// </summary>
|
|||
|
public static void PauseCommands()
|
|||
|
{
|
|||
|
if (lastPlayedStep && lastPlayedStep.isActive)
|
|||
|
{
|
|||
|
if (lastPlayedStep.attachedStepTimeline)
|
|||
|
lastPlayedStep.attachedStepTimeline.Pause();
|
|||
|
else if (lastPlayedStep.attachedController)
|
|||
|
lastPlayedStep.attachedController.Pause();
|
|||
|
|
|||
|
pausedOnStep = lastPlayedStep;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Resume all commands on the currently active timeline or controller (if one was active when game was paused)
|
|||
|
/// </summary>
|
|||
|
public static void ResumeCommands(float _elapsedTime)
|
|||
|
{
|
|||
|
// Resume
|
|||
|
if (pausedOnStep)
|
|||
|
{
|
|||
|
if (pausedOnStep.attachedStepTimeline)
|
|||
|
pausedOnStep.attachedStepTimeline.Resume(_elapsedTime);
|
|||
|
else if (pausedOnStep.attachedController)
|
|||
|
pausedOnStep.attachedController.Resume(_elapsedTime);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|