Class EventManager

java.lang.Object
com.skloch.game.EventManager

public class EventManager extends Object
A class that maps Object's event strings to actual Java functions.
  • Field Details

  • Constructor Details

    • EventManager

      public EventManager(GameScreen game)
      A class that maps Object's event strings to actual Java functions. To run a function call event(eventString), to add arguments add dashes. E.g. a call to the Piazza function with an arg of 1 would be: "piazza-1" Which the function interprets as "study at the piazza for 1 hour". Object's event strings can be set in the Tiled map editor with a property called "event"
      Parameters:
      game - An instance of the GameScreen containing a player and dialogue box
  • Method Details

    • event

      public void event(String eventKey)
    • getObjectInteraction

      public String getObjectInteraction(String key)
      Gets the interaction text associated with each object via a key
      Parameters:
      key -
      Returns:
      The object interaction text
    • hasCustomObjectInteraction

      public boolean hasCustomObjectInteraction(String key)
      Returns:
      True if the object has some custom text to display that isn't just "This is an x!"
    • treeEvent

      public void treeEvent()
      Sets the text when talking to a tree
    • chestEvent

      public void chestEvent()
    • objectEvent

      public void objectEvent(String object)
      Sets the text when talking to an object without a dedicated function
    • piazzaEvent

      public void piazzaEvent(String[] args)
      Lets the player study at the piazza for x num of hours, decreases the player's energy and increments the game time.
      Parameters:
      args - Arguments to be passed, should contain the hours the player wants to study. E.g. ["piazza", "1"]
    • randomTopics

      private String[] randomTopics(int amount)
      Parameters:
      amount - The amount of topics to return
      Returns:
      An array of x random topics the player can chat about
    • compSciEvent

      public void compSciEvent(String[] args)
      The event to be run when interacting with the computer science building Gives the player the option to study for 2, 3 or 4 hours
      Parameters:
      args -
    • ronCookeEvent

      public void ronCookeEvent(String[] args)
      The event to be run when the player interacts with the ron cooke hub Gives the player the choice to eat breakfast, lunch or dinner depending on the time of day
      Parameters:
      args -
    • accomEvent

      public void accomEvent(String[] args)
      Lets the player go to sleep, fades the screen to black then shows a dialogue about the amount of sleep the player gets Then queues up fadeFromBlack to be called when this dialogue closes
      Parameters:
      args - Unused currently
      See Also:
    • fadeToBlack

      public void fadeToBlack()
      Fades the screen to black
    • fadeToBlack

      public void fadeToBlack(com.badlogic.gdx.scenes.scene2d.actions.RunnableAction runnable)
      Fades the screen to black, then runs a runnable after it is done
      Parameters:
      runnable - A runnable to execute after fading is finished
    • fadeFromBlack

      public void fadeFromBlack()
      Fades the screen back in from black, displays a good morning message if the player was sleeping