java.lang.Object
de.tum.cit.fop.maze.objects.GameObject
de.tum.cit.fop.maze.objects.Static.Exit
All Implemented Interfaces:
Saveable<ExitMemento>

public class Exit extends GameObject implements Saveable<ExitMemento>
Exit portal that can be locked or unlocked with keys.
  • Constructor Details

    • Exit

      public Exit(float x, float y)
  • Method Details

    • open

      public void open()
      Opens the exit by unlocking it.
    • isLocked

      public boolean isLocked()
      Checks if exit is locked.
      Returns:
      True if locked
    • getMemento

      public ExitMemento getMemento()
      Description copied from interface: Saveable
      Creates a memento capturing the current state of this object.
      Specified by:
      getMemento in interface Saveable<ExitMemento>
      Returns:
      A memento containing the object's state
    • loadFromMemento

      public void loadFromMemento(ExitMemento memento)
      Description copied from interface: Saveable
      Restores the object's state from a memento.
      Specified by:
      loadFromMemento in interface Saveable<ExitMemento>
      Parameters:
      memento - The memento containing the state to restore