|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvooga.gameEngine.core.GameManager
public class GameManager
Class responsible for communication between the game and the engine. An
instance of the class is added to the game by the engine. It can then be used
to get game specific controllers and add and remove objects from the game.
This class should be used by the AbstractGame
whenever an object
needs to be added by the game.
Constructor Summary | |
---|---|
GameManager(GameEngine engine,
java.util.Collection<? extends java.util.EventListener> gameStatusListeners)
Creates a GameManager object provided the GameEngine
it will communicate with and the collection of EventListener s
with which to communicate important information. |
Method Summary | |
---|---|
boolean |
addAllGeneralItems(java.util.Collection<? extends java.lang.Object> items)
Adds all the new Object s as general items for the game. |
boolean |
addAllLevelItems(java.util.Collection<? extends java.lang.Object> items)
Adds all the given Object s as level items. |
boolean |
addAllPersistentItems(java.util.Collection<? extends java.lang.Object> items)
Adds all the given Object s as persistent items. |
boolean |
addGeneralItem(java.lang.Object item)
Adds a new Object as a general item. |
boolean |
addLevelItem(java.lang.Object item)
Adds a new Object as a level item. |
boolean |
addPersistentItem(java.lang.Object item)
Adds a new Object as a persistent item. |
AIController |
getAIController()
Method for getting the AIController . |
java.util.List<Collidable<? extends Collidable<?>>> |
getAllCollidables()
Method for getting all the current Collidable items. |
java.util.Collection<java.lang.Object> |
getAllGeneralItems()
Method for getting all the current Object s in the game. |
java.util.Collection<java.lang.Object> |
getAllLevelItems()
Method for getting all the current level Object s. |
java.util.List<PhysicalItem> |
getAllNonCollidablePhysicalItems()
Method for getting all the current PhysicalItem s that are not
Collidable . |
java.util.Collection<java.lang.Object> |
getAllPersistentItems()
Method for getting all the current persistent Object s. |
java.util.List<PhysicalItem> |
getAllPhysicalItems()
Method for getting all the current PhysicalItem s. |
java.util.Set<Renderable> |
getAllRenderables()
Method for getting all the current Renderable items. |
CameraController |
getCamera()
Gets the the camera used by this game. |
HumanController |
getHumanController()
Method for getting the HumanController . |
java.util.Collection<java.lang.Object> |
getInitialState()
Loads the initial state of a level back into a Collection of
Object s. |
NetworkController |
getNetworkController()
Method for getting the NetworkController . |
double |
getScore()
Simple getter method for the score of the AbstractGame at
the time of the method being called. |
SoundController |
getSoundController()
Method for getting the SoundController . |
TimingController |
getTimingController()
Method for getting the TimingController . |
boolean |
pauseGameLoop()
Attempts to pause the game loop. |
void |
reachedAchievement(java.lang.String achievement)
Method to be called when an achievement has been made during game play. |
boolean |
removeAllGeneralItems()
Removes all of the loaded, non-persistent Object s from the game. |
boolean |
removeAllItems()
Removes ALL loaded Object s from their relevant collections. |
boolean |
removeAllItems(java.util.Collection<? extends java.lang.Object> items)
Removes all given Object s from their relevant collections. |
boolean |
removeAllLevelItems()
Removes all of the non-persistent level Object s. |
boolean |
removeAllPersistentItems()
Removes all of the persistent Object s. |
boolean |
removeItem(java.lang.Object item)
Removes the given Object from all relevant collections. |
void |
resumeGameLoop()
Attempts to resume the game loop. |
void |
setCamera(CameraController c)
Sets the camera to the CameraController specific to this
game. |
void |
setScore(double score)
Simple setter method for the score of the AbstractGame . |
void |
storeInitialState(java.util.Collection<java.lang.Object> items)
Saves the initial state of a level in a ByteArrayOutputStream . |
void |
updateScore()
Notifies all relevant listeners of the latest score. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GameManager(GameEngine engine, java.util.Collection<? extends java.util.EventListener> gameStatusListeners)
GameManager
object provided the GameEngine
it will communicate with and the collection of EventListener
s
with which to communicate important information.
engine
- the GameEngine
this GameManager
is
associated withgameStatusListeners
- the Collection
of EventListeners
to
be notified of important information regarding the game
status, such as the score or any achievements madeMethod Detail |
---|
public boolean addGeneralItem(java.lang.Object item)
Object
as a general item.
item
- to be added
public boolean addLevelItem(java.lang.Object item)
Object
as a level item.
item
- to be added
public boolean addPersistentItem(java.lang.Object item)
Object
as a persistent item.
A persistent item is one that will not be removed by calls to
removeAllGeneralItems()
or removeAllLevelItems()
.
item
- to be added
public boolean addAllGeneralItems(java.util.Collection<? extends java.lang.Object> items)
Object
s as general items for the game.
items
- to be added
public boolean addAllLevelItems(java.util.Collection<? extends java.lang.Object> items)
Object
s as level items.
items
- to be added
public boolean addAllPersistentItems(java.util.Collection<? extends java.lang.Object> items)
Object
s as persistent items.
A persistent item is one that will not be removed by calls to
removeAllGeneralItems()
or removeAllLevelItems()
.
items
- to be added
public boolean removeItem(java.lang.Object item)
Object
from all relevant collections. Note that
calling this method directly will attempt to remove an Object
from the
overall collection of general items, the collection of level items, AND the collection of
persistent items.
item
- to be removed
public boolean removeAllItems(java.util.Collection<? extends java.lang.Object> items)
Object
s from their relevant collections.
Note that calling this method directly will attempt to remove the Object
s
from the overall collection of general items, the collection of level items, AND the collection of
persistent items.
items
- to be removed
public boolean removeAllItems()
Object
s from their relevant collections.
removeAllItems(Collection)
public boolean removeAllGeneralItems()
Object
s from the game.
public boolean removeAllLevelItems()
Object
s.
public boolean removeAllPersistentItems()
Object
s.
public java.util.Collection<java.lang.Object> getAllGeneralItems()
Object
s in the game.
Collection
of Object
s currently
stored.public java.util.List<Collidable<? extends Collidable<?>>> getAllCollidables()
Collidable
items.
List
of Collidable
items currently
stored.public java.util.List<PhysicalItem> getAllPhysicalItems()
PhysicalItem
s.
List
of PhysicalItem
s currently
stored.public java.util.List<PhysicalItem> getAllNonCollidablePhysicalItems()
PhysicalItem
s that are not
Collidable
.
List
of non-Collidable
PhysicalItem
s currently stored.public java.util.Collection<java.lang.Object> getAllLevelItems()
Object
s.
Collection
of all level Object
s
currently stored.public java.util.Set<Renderable> getAllRenderables()
Renderable
items.
List
of Renderable
items currently
stored.public java.util.Collection<java.lang.Object> getAllPersistentItems()
Object
s.
Collection
of all persistent Object
s currently stored.public TimingController getTimingController()
TimingController
.
TimingController
for the gamepublic NetworkController getNetworkController()
NetworkController
.
NetworkController
for the gamepublic HumanController getHumanController()
HumanController
.
HumanController
for the gamepublic AIController getAIController()
AIController
.
AIController
for the gamepublic SoundController getSoundController()
SoundController
.
SoundController
for the gamepublic void setCamera(CameraController c)
CameraController
specific to this
game.
c
- is the CameraController used by the gamepublic CameraController getCamera()
public void storeInitialState(java.util.Collection<java.lang.Object> items)
ByteArrayOutputStream
. When a new level is loaded, this
method is called by the AbstractGame
so that the level can be
reloaded in the event of a restart.
NOTE: NOT CURRENTLY CALLED
items
- Object
s to be storedpublic java.util.Collection<java.lang.Object> getInitialState()
Collection
of
Object
s. Useful in the event that the game needs to
restart the current level.
NOTE: NOT CURRENTLY CALLED
Collection
of Object
s that
defines a particular level.public double getScore()
AbstractGame
at
the time of the method being called.
public void setScore(double score)
AbstractGame
.
score
- of the gamepublic boolean pauseGameLoop()
public void resumeGameLoop()
public void reachedAchievement(java.lang.String achievement)
achievement
- that has been reachedpublic void updateScore()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |