Package com.skloch.game
Class EventManager
java.lang.Object
com.skloch.game.EventManager
A class that maps Object's event strings to actual Java functions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final GameScreenprivate final com.badlogic.gdx.utils.Array<String> -
Constructor Summary
ConstructorsConstructorDescriptionEventManager(GameScreen game) A class that maps Object's event strings to actual Java functions. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccomEvent(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 closesvoidvoidcompSciEvent(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 hoursvoidvoidFades the screen back in from black, displays a good morning message if the player was sleepingvoidFades the screen to blackvoidfadeToBlack(com.badlogic.gdx.scenes.scene2d.actions.RunnableAction runnable) Fades the screen to black, then runs a runnable after it is doneGets the interaction text associated with each object via a keybooleanvoidobjectEvent(String object) Sets the text when talking to an object without a dedicated functionvoidpiazzaEvent(String[] args) Lets the player study at the piazza for x num of hours, decreases the player's energy and increments the game time.private String[]randomTopics(int amount) voidronCookeEvent(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 dayvoidSets the text when talking to a tree
-
Field Details
-
game
-
activityEnergies
-
objectInteractions
-
talkTopics
-
-
Constructor Details
-
EventManager
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
-
getObjectInteraction
Gets the interaction text associated with each object via a key- Parameters:
key-- Returns:
- The object interaction text
-
hasCustomObjectInteraction
- 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
Sets the text when talking to an object without a dedicated function -
piazzaEvent
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
- Parameters:
amount- The amount of topics to return- Returns:
- An array of x random topics the player can chat about
-
compSciEvent
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
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
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
-