public void Pause() { // Set current playback direction as previous previousPlaybackDirection = playbackDirection; // Set to pause playbackDirection = PB_Direction.PAUSE; // Set placeback to false playback = false; }
void Start() { // Input Manager instace IM = s_InputManager.Instance; // Init starting variables currentFrame = 0; totalFrames = 0; keyframeTime = 0.0f; isNormal = true; // Set previous play direction previousPlaybackDirection = PB_Direction.FORWARD; // Init Objects to record GetObjectsToRecord(); }
// Function Commands //------------------------------------------------------------------ public void Play(PB_Direction direction) { if (totalFrames > 0) { // Set play direction to previous play direction playbackDirection = direction; // Freeze all objects FreezeAllObjects(true); // Set playback to play playback = true; } else { Debug.LogAssertion("Nothing Recorded to Play"); } }
void PlaybackFrames() { // if playing forward and on last frame if (playbackDirection == PB_Direction.FORWARD && currentFrame == totalFrames) { if (isNormal) { // Stop playing playbackDirection = PB_Direction.PAUSE; // Playback is done inPlayback = false; playback = false; // Set input update IM.updateInput = true; } // If set to loop else if (isLooping) { // Set to first frame currentFrame = 0; } else if (isPingPong) { // Change play direction playbackDirection = PB_Direction.REVERSE; // bounce to previous frame currentFrame -= 1; } } // if playing reverse and on first frame else if (playbackDirection == PB_Direction.REVERSE && currentFrame == 0) { if (isNormal) { playbackDirection = PB_Direction.PAUSE; } // If set to loop else if (isLooping) { // Set to last frame currentFrame = (totalFrames - 1); } else if (isPingPong) { // Reverse playback direction playbackDirection = PB_Direction.FORWARD; // bounce to next frame currentFrame += 1; } } else if (playbackDirection == PB_Direction.REVERSE && currentFrame == totalFrames) { // Play in reverse to previous frame currentFrame -= 1; } // middle frames else if (currentFrame < totalFrames && currentFrame >= 0) { SetCurrentFrame(); // Increment/Decrement frame count currentFrame += 1 * (int)playbackDirection; } }