group1.model
Class AudioModelMediator

java.lang.Object
  extended by group1.model.AudioModelMediator

public class AudioModelMediator
extends java.lang.Object

A special mediator class that should be referenced by anything in the model that needs to cue AudioEvents.


Method Summary
static AudioModelMediator getInstance()
          Get an instance of this class.
 boolean playAudio(Audio a)
          Play the requested audio.
 void setGame(Game g)
          Set the game referenced by this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static AudioModelMediator getInstance()
Get an instance of this class. (Singleton design pattern.)

Returns:
The instance of this class.

setGame

public void setGame(Game g)
Set the game referenced by this class. (This must be done first!)

Parameters:
g - The game.

playAudio

public boolean playAudio(Audio a)
Play the requested audio. (More specifically: Send a signal to the Game class to send an event to the view class to play audio.) The "game" object must be set first, or this method has no meaning and will fail.

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