|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectsema.Element
sema.Agent
modelling.MovingAgent
Agent with abilities to move.
| Nested Class Summary | |
protected class |
MovingAgent.Errer
A default action to errate on the map without verification of the collisions with other elements. |
protected class |
MovingAgent.MoveTo
Moves to the given point. |
| Nested classes inherited from class sema.Agent |
Agent.Action |
| Nested classes inherited from class sema.Element |
Element.ElementEvent |
| Field Summary |
| Fields inherited from class sema.Element |
id, world |
| Constructor Summary | |
MovingAgent(World world,
Area area,
float delay,
java.awt.Image image,
float speed)
Receives a speed and the paramaters of a normal agent. |
|
| Method Summary | |
protected boolean |
acceptAction(Agent.Action a)
Global internal heuristic method of decision as to the actions to undertake. |
protected float |
canSee(float angle)
Returns the maximum distance that can be seen in this direction. |
protected boolean |
fitStep()
Chooses the best direction where to move (where the largest move is possibleà and walk one step in this direction. |
float |
getSpeed()
Returns the speed of the agent. |
protected boolean |
randomStep(float a)
|
protected boolean |
rotate(float a)
Rotation with collision check. |
protected void |
setSpeed(float speed)
Sets the speed of the agent. |
protected boolean |
translate(float x,
float y)
Translation with collision check. |
protected boolean |
walk(float f)
Walk in the direction gived by the element angle, checking collisions. |
| Methods inherited from class sema.Agent |
getDelay, registerAction, setDelay, unregisterAction |
| Methods inherited from class sema.Element |
canTake, compareTo, death, draw, getArea, getDrawingPriority, getHeight, getIcon, getImage, getKind, getName, getProperties, highlight, highlight, isMarked, kill, setDrawingPriority, setHeight, setKind, setMarked, setProperties, toString, union |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public MovingAgent(World world,
Area area,
float delay,
java.awt.Image image,
float speed)
| Method Detail |
protected void setSpeed(float speed)
public final float getSpeed()
protected boolean acceptAction(Agent.Action a)
AgentAgent.Action.whenRefused() method is called
and the action who called acceptAction is killed.
This method has an overwhelming power of decision on the action,
which cannot ignore this decision.
The default acceptAction method always returns true.
It's designed to provide an easy-to-use main decision function to manage actions.
acceptAction in class Agent
protected boolean translate(float x,
float y)
protected boolean rotate(float a)
protected boolean walk(float f)
protected boolean fitStep()
protected float canSee(float angle)
protected boolean randomStep(float a)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||