|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.kernel.motion.AxisShapeChanger
This class implements a standard deformation used by monsters that switch from horizontal to vertical when they change directions. This includes sharks, Nagas, and any 1x2/2x1 monster that needs to change shape in the "standard" way when it moves.
To use this class, have your monster add a "deformer" property whose value is an instance of this class, and all will be well.
Constructor Summary | |
AxisShapeChanger()
|
Method Summary | |
CommandEvent |
createEvent(CommandEvent initial)
Creates the event. |
boolean |
execute(CommandEvent event)
Executes the event (by refusing). |
java.util.List |
getDestination(GameObject agent,
int dir,
Point offsets)
A stateless (and therefore unsynchronized) implementation of getDestination that objects can delegate to. |
static boolean |
horizontal(java.util.List source)
Returns true if the agent is currently horizontal. |
boolean |
knowsCommand(java.lang.String command)
We know the command if it's turn + direction. |
java.lang.String |
mapDirection(int dir,
GameObject obj)
Chooses a direction for the specified object. |
void |
notifyAdd(PropertyList obj)
Notifies the property that it's being added. |
void |
notifyRemove(PropertyList obj)
Notifies the property that it's being removed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AxisShapeChanger()
Method Detail |
public java.util.List getDestination(GameObject agent, int dir, Point offsets)
getDestination
in interface Deformer
agent
- the object to movedir
- a wyvern.lib.Direction constant (movement direction)offsets
- the results of calling Direction.getXYOffsets(dir),
passed in so you don't have to do it.
public static boolean horizontal(java.util.List source)
source
- the agent's location list
public java.lang.String mapDirection(int dir, GameObject obj)
mapDirection
in interface DirectionChooser
dir
- the direction the object is currently facingobj
- the object to choose for.
public boolean knowsCommand(java.lang.String command)
knowsCommand
in interface Command
command
- the entire command string, including arguments
public CommandEvent createEvent(CommandEvent initial)
createEvent
in interface Command
initial
- a "blank" CommandEvent containing only the
command text and the agent who's performing the command. This
initial event is created by the originator of the event (e.g.
the AI or player's command preprocessor).
public boolean execute(CommandEvent event)
execute
in interface Command
event
- the CommandEvent to execute
public void notifyAdd(PropertyList obj)
notifyAdd
in interface AddRemoveNotify
obj
- the GameObject whose property list we're being
added topublic void notifyRemove(PropertyList obj)
notifyRemove
in interface AddRemoveNotify
obj
- the GameObject whose property list we're being
removed from
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |