Interface EntityListInterface
- All Known Implementing Classes:
AlienArmyArray,EntityListArray
public interface EntityListInterface
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an entityvoidManage event listener registrationvoidclear()Clear the listcollidesWith(Entity other) Check if this entity collides with any entity in this entity list.voiddraw(Graphics2D g) draw all entities in the listintNumber of entitiesreturn one of the entities in the list - choosing it randomly If there are no entities in the list will return nullvoidincreaseSpeed(int percentIncr) Increase the speed of all members of this list by a certain percentagevoidmoveAndDraw(long delta, Graphics2D g) Move and drawvoidRegisters an entity for removal next time the state of the list is updatedvoidRemove an entity from the listvoidupdateState(long delta) Move all entities in the list according to time passed delta.
-
Method Details
-
clear
void clear()Clear the list -
add
-
increaseSpeed
void increaseSpeed(int percentIncr) Increase the speed of all members of this list by a certain percentage- Parameters:
percentIncr-
-
registerEntityForRemoval
Registers an entity for removal next time the state of the list is updated- Parameters:
e- The entity to register for removal next time the upDateState is called on the list
-
updateState
void updateState(long delta) Move all entities in the list according to time passed delta.- Parameters:
delta- Time passed since last updateState (ms)
-
draw
draw all entities in the list- Parameters:
g- The graphics context to draw to
-
moveAndDraw
Move and draw- Parameters:
delta- Time passed since last updateState (ms)g- The graphics context to draw to
-
collidesWith
-
addEntityEventListener
Manage event listener registration- Parameters:
l- the listener to add
-
remove
-
getNumEntities
int getNumEntities()Number of entities- Returns:
- The number of entities
-
getRandom
Entity getRandom()return one of the entities in the list - choosing it randomly If there are no entities in the list will return null- Returns:
-