feud.testgame.model
Class LocalBulletManager

java.lang.Object
  extended byfeud.testgame.model.LocalBulletManager

public class LocalBulletManager
extends java.lang.Object

Manager class for bullets. A bullet is an instance of LocalBullet in this case.


Constructor Summary
LocalBulletManager()
          Creates a new manager.
 
Method Summary
 LocalObject addBullet(LocalPlayerObject player, com.threed.jpct.World world)
          Adds a new bullet to the manager and, if not null, a new view for that bullet to the world.
 java.util.List fillOrKill(ExtendedDataContainer dc)
          Prepares a data container with the data of all currently active bullets on a client and adds all still exisiting but inactive bullets to a "to-kill"-List.
 com.threed.jpct.SimpleVector getInitialPosition(LocalPlayerObject player)
          Gets the initial position of a newly fired bullet.
 LocalObject getLocalObjectToView(ClientObject co)
          The collision detection routines work with the view objects, not with the model.
 void moveLocalBullets(long ticks, Level level)
          Moves the bullets according top their speed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalBulletManager

public LocalBulletManager()
Creates a new manager.

Method Detail

getLocalObjectToView

public LocalObject getLocalObjectToView(ClientObject co)
The collision detection routines work with the view objects, not with the model. Therefore, it's required to map the view to the model. To minimize dependencies, this is done by using this mathod.

Parameters:
co - the view
Returns:
LocalObject the corresponding model (or null if there is none...what shouldn't happen)

getInitialPosition

public com.threed.jpct.SimpleVector getInitialPosition(LocalPlayerObject player)
Gets the initial position of a newly fired bullet.

Parameters:
player - the player which fires the bullet
Returns:
SimpleVector the position

addBullet

public LocalObject addBullet(LocalPlayerObject player,
                             com.threed.jpct.World world)
Adds a new bullet to the manager and, if not null, a new view for that bullet to the world.

Parameters:
player - the player which fires the bullet
world - the world in which the player exists
Returns:
LocalObject the new bullet model

moveLocalBullets

public void moveLocalBullets(long ticks,
                             Level level)
Moves the bullets according top their speed. This happens to the model and, if present, to the view too.

Parameters:
ticks - the game time that has passed since the last call
level - the current level (this can be null if the bullet has no view)

fillOrKill

public java.util.List fillOrKill(ExtendedDataContainer dc)
Prepares a data container with the data of all currently active bullets on a client and adds all still exisiting but inactive bullets to a "to-kill"-List.

Parameters:
dc - the container to be filled
Returns:
List the list with inactive bullets that weren't added to the container