feud.testgame.view
Class ClientObjectManager

java.lang.Object
  extended byfeud.testgame.view.ClientObjectManager

public class ClientObjectManager
extends java.lang.Object

A manager class for handling client objects. This manager holds references to all client objects that this client knows of (event remote ones).


Constructor Summary
ClientObjectManager()
          Creates a new manager.
 
Method Summary
 ClientObject getClientObject(int objID, int clientID)
          Gets a client object that has been created on a remote client with a given id.
 java.util.Collection getClientObjects()
          Returns all client objects that this manager knows of.
 LocalObject getLocalObjectToView(ClientObject co)
          Returns the underlying data model of a view object.
 ClientObject getOrCreateClientObject(LocalObject lo, com.threed.jpct.World world, LocalBulletManager bulMan)
          Returns the view object for a given local object.
 void remove(ClientObject co, com.threed.jpct.World world)
          Removes a single object from the manager and the world.
 void removeAll(com.threed.jpct.World world)
          Removes all objects from the manager and the world.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientObjectManager

public ClientObjectManager()
Creates a new manager.

Method Detail

getClientObjects

public java.util.Collection getClientObjects()
Returns all client objects that this manager knows of.

Returns:
Collection the client objects

getLocalObjectToView

public LocalObject getLocalObjectToView(ClientObject co)
Returns the underlying data model of a view object.

Parameters:
co - the view object
Returns:
LocalObject the underlying local object that the view object represents

getClientObject

public ClientObject getClientObject(int objID,
                                    int clientID)
Gets a client object that has been created on a remote client with a given id. If no such object exists, it returns null.

Parameters:
objID - the id of the object
clientID - the id of the client
Returns:
ClientObject the object or null

getOrCreateClientObject

public ClientObject getOrCreateClientObject(LocalObject lo,
                                            com.threed.jpct.World world,
                                            LocalBulletManager bulMan)
Returns the view object for a given local object. If the manager already knows of this object, it returns that one. If it doesn't, it creates a new one and returns that.

Parameters:
lo - the local object on which the view is based
world - the current world (needed, because the manager has to add the new view object to it)
bulMan - the manager for the local bullets (because collisions of local bullets with this object has be determined)
Returns:
ClientObject the object

removeAll

public void removeAll(com.threed.jpct.World world)
Removes all objects from the manager and the world.

Parameters:
world - the current world

remove

public void remove(ClientObject co,
                   com.threed.jpct.World world)
Removes a single object from the manager and the world.

Parameters:
co - the object to remove
world - the world