group1.model
Class Game

java.lang.Object
  extended by group1.model.Game
All Implemented Interfaces:
java.lang.Runnable

public class Game
extends java.lang.Object
implements java.lang.Runnable

The game class. This is sort of the "main" model class. This controls time clicks in the environment, moving between levels, and menus. It's also responsible for sending events on these things to the view.


Constructor Summary
Game()
          The game constructor.
 
Method Summary
 void addPoints(int points)
          Add points to the total score.
 Jeff getJeff()
          Returns Jeff to the master class
 int getLevelCount()
          Returns the result of the level counter.
 int getScore()
          Get the current score.
 void incrementLevelCount()
          Increment the level counter by one (when Jeff reaches the end of a level
 void instructions(InstructionsEvent i)
           
 int inTheMainMenu()
          In the main menu...
 java.lang.String levelName()
          Returns the appropriate level name when passed the level counter.
 void loadGame()
           
 void mainMenu(MainMenuEvent m)
           
 void newGame()
           
 void pause(PauseMenuEvent p)
           
 void pauseEnvironment()
           
 void playAudio(Audio a)
          Play the requested audio.
 void quit()
           
 void resumeEnvironment()
           
 void run()
          Run the game, by running time clicks in the environment.
 void saveGame()
           
 void setAudioListener(AudioListener m)
          Sets the audio listener
 void setBuyMenuListener(BuyMenuListener m)
          Sets the buy menu listener
 void setContinueMenuListener(ContinueMenuListener m)
          Sets the continue menu listener
 void setEndOfLevelListener(EndOfLevelListener m)
          Sets the end of level listener
 void setInGameListener(InGameListener m)
          Sets the in game listener
 void setInstructionsListener(InstructionsListener m)
          Sets the instructions listener
 void setJeffDiesListener(JeffDiesListener m)
          Sets the Jeff dies listener
 void setLoadListener(LoadListener m)
          Sets the load listener
 void setMainMenuListener(MainMenuListener m)
          Sets the main menu listener
 void setNewGameListener(NewGameListener m)
          Sets the new game listener
 void setPauseMenuListener(PauseMenuListener m)
          Sets the pause menu listener
 void setSaveListener(SaveListener m)
          Sets the save listener
 void setStartOfLevelListener(StartOfLevelListener m)
          Sets the set start of level listener
 void setWeaponsSwitchMenuListener(WeaponSwitchMenuListener m)
          Sets the weapon switch menu listener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Game

public Game()
The game constructor. Creates a Jeff, an Environment, and loads the picture cache.

Method Detail

run

public void run()
Run the game, by running time clicks in the environment.

Specified by:
run in interface java.lang.Runnable

incrementLevelCount

public void incrementLevelCount()
Increment the level counter by one (when Jeff reaches the end of a level


getLevelCount

public int getLevelCount()
Returns the result of the level counter.

Returns:
the level count result

levelName

public java.lang.String levelName()
Returns the appropriate level name when passed the level counter.

Returns:
the appropriate levelString

pause

public void pause(PauseMenuEvent p)

instructions

public void instructions(InstructionsEvent i)

pauseEnvironment

public void pauseEnvironment()

resumeEnvironment

public void resumeEnvironment()

mainMenu

public void mainMenu(MainMenuEvent m)

quit

public void quit()

newGame

public void newGame()

saveGame

public void saveGame()

loadGame

public void loadGame()

getJeff

public Jeff getJeff()
Returns Jeff to the master class

Returns:
The game's Jeff

setMainMenuListener

public void setMainMenuListener(MainMenuListener m)
Sets the main menu listener

Parameters:
m - the model listener

setPauseMenuListener

public void setPauseMenuListener(PauseMenuListener m)
Sets the pause menu listener

Parameters:
m - the model listener

setBuyMenuListener

public void setBuyMenuListener(BuyMenuListener m)
Sets the buy menu listener

Parameters:
m - the model listener

setContinueMenuListener

public void setContinueMenuListener(ContinueMenuListener m)
Sets the continue menu listener

Parameters:
m - the model listener

setWeaponsSwitchMenuListener

public void setWeaponsSwitchMenuListener(WeaponSwitchMenuListener m)
Sets the weapon switch menu listener

Parameters:
m - the model listener

setNewGameListener

public void setNewGameListener(NewGameListener m)
Sets the new game listener

Parameters:
m - the model listener

setSaveListener

public void setSaveListener(SaveListener m)
Sets the save listener

Parameters:
m - the model listener

setLoadListener

public void setLoadListener(LoadListener m)
Sets the load listener

Parameters:
m - the model listener

setInstructionsListener

public void setInstructionsListener(InstructionsListener m)
Sets the instructions listener

Parameters:
m - the model listener

setStartOfLevelListener

public void setStartOfLevelListener(StartOfLevelListener m)
Sets the set start of level listener

Parameters:
m - the model listener

setEndOfLevelListener

public void setEndOfLevelListener(EndOfLevelListener m)
Sets the end of level listener

Parameters:
m - the model listener

setJeffDiesListener

public void setJeffDiesListener(JeffDiesListener m)
Sets the Jeff dies listener

Parameters:
m - the model listener

setInGameListener

public void setInGameListener(InGameListener m)
Sets the in game listener

Parameters:
m - the model listener

setAudioListener

public void setAudioListener(AudioListener m)
Sets the audio listener

Parameters:
m - the audio listener

inTheMainMenu

public int inTheMainMenu()
In the main menu...


playAudio

public void playAudio(Audio a)
Play the requested audio. More specifically: Send an event to the view class to play audio.

Parameters:
a - The enum type of the requested audio. //@return Whether or not this method was successful.

addPoints

public void addPoints(int points)
Add points to the total score. (Score is tallied over the course of an entire game and never reset, and should probably serve as experience points or money.)

Parameters:
points - The number of points to add.

getScore

public int getScore()
Get the current score.

Returns:
The score.