Class Replay

java.lang.Object
nz.ac.vuw.ecs.swen225.gp6.recorder.Replay
All Implemented Interfaces:
Runnable

public final class Replay extends Object implements Runnable
Class for replaying a recorded game. The Replay class observes the App to be updated of the time, to make sure actions are in sync with the game. This allows the App to still have control of the game during replay.
  • Field Details

    • INSTANCE

      public static final Replay INSTANCE
      The singleton instance of the Replay class.
  • Method Details

    • setReplay

      public void setReplay(App app)
      Sets the Replay object up with an App.
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • load

      public Replay load(int slot)
      Load method will load the game from the given file name.
      Parameters:
      slot - the slot number to load the game from.
      Returns:
      this replay object to chain methods.
    • step

      public Replay step()
      Method queues the next action in the timeline if available. If there is no next action, the method will pop up a message.
      Returns:
      this replay object to chain methods.
    • autoPlay

      public Replay autoPlay()
      Method enables the autoPlay functionality.
      Returns:
      this replay object to chain methods.
    • pauseReplay

      public Replay pauseReplay()
      Method to pause the autoplay feature.
      Returns:
      this replay object to chain methods.
    • speedMultiplier

      public Replay speedMultiplier(float speed)
      Method sets the speed of the autoplay.
      Parameters:
      speed - the speed to set the replay to.
      Returns:
      this replay object to chain methods.
    • stopReplay

      public Replay stopReplay()
      Method exits the replay mode.
      Returns:
      this replay object to chain methods.