|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectbe.saltwater.jaqel.scheduler.CreatureAction
An action that a creature can execute. Subclasses implement the actual behavior of the action by overriding actionStarted and actionFinished. Subclasses should also specify the animation that are part of the action. They should do this by adding ScheduledBehavior's with the method addAnimation. If an action has no animations, it is not executed but skipped. The animations must be added at constructor time.
CreatureActionScheduler,
Creature| Constructor Summary | |
CreatureAction(CreatureActionScheduler scheduler,
Creature actor)
Constructor for subclasses. |
|
| Method Summary | |
void |
actionFinished()
Called by CreatureActionScheduler when the action is finished. |
void |
actionStarted()
Called by CreatureActionScheduler when the action is started. |
protected void |
addAnimation(ScheduledBehavior animation)
Subclasses must call this method to add their animations. |
void |
animationFinished(ScheduledBehavior animation)
Called by CreatureActionScheduler when an animation of this action is finished. |
Creature |
getActorCreature()
|
protected java.util.List |
getAnimations()
Gets an unmodifiable, synchronized list containing all the animations (ScheduledBehavior), mainly used by CreatureActionScheduler. |
abstract int |
getCost()
Subclasses should calculate the cost in actionpoints to complete this action in this method |
CreatureActionScheduler |
getCreatureActionScheduler()
The creature action scheduler this action will be executed by. |
java.awt.Point |
getEndLocation()
If this action modifies the location of the Creature, return the end location, default implementation returns null. |
int |
isAllowed(CreatureActionScheduler scheduler)
Returns if this action can be executed. |
abstract int |
isValid()
Subclasses should return a Creature.ORDER_* status code that indicates if this action is valid. return Creature.ORDER_OK if all is ok. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CreatureAction(CreatureActionScheduler scheduler,
Creature actor)
actor - The acting creature| Method Detail |
public final int isAllowed(CreatureActionScheduler scheduler)
getCost(),
Creature.getActionPoints()public abstract int getCost()
Creature.getActionPoints()public abstract int isValid()
public void actionStarted()
public void actionFinished()
public void animationFinished(ScheduledBehavior animation)
animation - The animation that is terminated.protected java.util.List getAnimations()
protected void addAnimation(ScheduledBehavior animation)
animation - The animation that belongs to this animationgetAnimations(),
CreatureActionScheduler.execute(be.saltwater.jaqel.scheduler.CreatureAction)public CreatureActionScheduler getCreatureActionScheduler()
public Creature getActorCreature()
public java.awt.Point getEndLocation()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||