Gamestate.java 861 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package pathgame.gameplay;
  2. /**
  3. * A container for the gamestate
  4. *
  5. * @author julia
  6. */
  7. public class Gamestate
  8. {
  9. private Gamestates state = Gamestates.MENU;
  10. /**
  11. * Sets the current gamestate
  12. *
  13. * @param state the desired gamestate
  14. */
  15. public void setState(Gamestates state)
  16. {
  17. this.state = state;
  18. }
  19. /**
  20. * Returns the current gamestate
  21. *
  22. * @return the current game state
  23. */
  24. public Gamestates getState()
  25. {
  26. return state;
  27. }
  28. /**
  29. * Returns if current gamestate is same as gamestate from parameter
  30. *
  31. * @param gamestate the gamestate that has to be checked if it is the
  32. * current
  33. * @return if current gamestate is same as gamestate from parameter
  34. */
  35. public boolean is(Gamestates gamestate)
  36. {
  37. return state == gamestate;
  38. }
  39. }