group1.model
Class DeathModelMediator

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

public class DeathModelMediator
extends java.lang.Object

A special mediator class that tells the Environment when GameObjs should be removed. Used whenever a GameObj dies/dissipates/vanishes/is squished/is banished to another dimension/etc. (Um, rest in peace?)


Method Summary
static DeathModelMediator getInstance()
          Get an instance of this class.
 boolean removeObj(GameObj obj)
          Remove the requested object from the current environment.
 void setEnvironment(Environment e)
          Set the environment 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 DeathModelMediator getInstance()
Get an instance of this class. (Singleton design pattern.)

Returns:
The instance of this class.

setEnvironment

public void setEnvironment(Environment e)
Set the environment referenced by this class. (This must be done first!)

Parameters:
e - The environment with the GameObjs.

removeObj

public boolean removeObj(GameObj obj)
Remove the requested object from the current environment. (More specifically: Send a signal to the Environment class to remove the object.) The "environment" object must be set first, or this method has no meaning and will fail. It will also fail if the GameObj is not is the CURRENT environment, which means we didn't set it.

Parameters:
obj - The GameObj to be removed.
Returns:
Whether or not this method was successful.