|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object appletbots.WorldObject appletbots.Agent appletbots.CarrierAgent
public abstract class CarrierAgent
This class represents an agent that can pick up objects in the appletbots world.
Field Summary |
---|
Fields inherited from class appletbots.Agent |
---|
accelerationVectorColor, maxAcceleration, sight, velocityVectorColor, world |
Fields inherited from class appletbots.WorldObject |
---|
color, mass, maxSpeed, size |
Constructor Summary | |
---|---|
CarrierAgent(int pickUpDistance,
int size,
int sight,
double maxSpeed,
double maxAcceleration)
Constructs an agent with the given parameters |
Method Summary | |
---|---|
protected void |
drop(CarriableObject item)
Drops an object |
CarriableObject[] |
getInventory()
Returns the contents of the agent's inventory |
int |
getPickUpDistance()
Returns the distance the agents needs to be from an object to be able to pick it up |
boolean |
hasItem(CarriableObject item)
Returns whether or not the agent is carrying the given item |
boolean |
hasItems()
Returns whether or not the agent is carrying any items |
protected void |
pickUp(CarriableObject item)
Picks up an object |
Methods inherited from class appletbots.Agent |
---|
getAcceleration, getMaxAcceleration, getRandomAcceleration, getShowAcceleration, getShowVelocity, getSight, getVectorsToDraw, observeWorld, setAcceleration, setShowAcceleration, setShowVelocity, setWorld |
Methods inherited from class appletbots.WorldObject |
---|
collidedWith, getColor, getMass, getMaxSpeed, getSize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CarrierAgent(int pickUpDistance, int size, int sight, double maxSpeed, double maxAcceleration)
pickUpDistance
- How close a CarrierAgent must be to an object to
pick it upsize
- The agent's radiussight
- The distance the agent can seemaxSpeed
- The maximum speed the agent can travelmaxAcceleration
- The maximum acceleration for this agentMethod Detail |
---|
protected void pickUp(CarriableObject item)
item
- The object to pick upprotected void drop(CarriableObject item) throws CollisionException
item
- The object to drop
CollisionException
- Thrown if the item cannot be dropped within
the "pickup distance"public boolean hasItem(CarriableObject item)
item
- The item to check for
public boolean hasItems()
public final CarriableObject[] getInventory()
public int getPickUpDistance()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |