Class GameState

java.lang.Object
nz.ac.vuw.ecs.swen225.gp22.recorder.GameState

public class GameState extends Object
The game state class to store the game state.
Author:
Chris
  • Constructor Details

    • GameState

      protected GameState(int id, int time)
      Create a new game state.
      Parameters:
      id - the id of the game state
      time - the time of the game state
    • GameState

      protected GameState(int id, int time, List<Action> actions)
      Add an action to the game state.
      Parameters:
      id - the id of the action
      time - the time of the action
      actions - the actions to add
  • Method Details

    • addAction

      protected void addAction(Action action)
      Add an action to the game state.
      Parameters:
      action - The action to add.
    • getTime

      public int getTime()
      Get the time of the game state.
      Returns:
      The time of the game state.
    • apply

      public void apply(Base base)
      Apply this game state.
      Parameters:
      base - the base to call the apply method on
    • undo

      public void undo(Base base)
      Undo this game state.
      Parameters:
      base - the base to call the undo method on
    • toxml

      public org.dom4j.Element toxml()
      Convert the game state to xml.
      Returns:
      The xml element of the game state.