|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectus.asciiroth.client.core.AbstractPiece
us.asciiroth.client.terrain.decorators.Decorator
public abstract class Decorator
A base class for terrain types that can augment the behavior of another terrain,
looking like that terrain but behaving differently. Decorators receive color events,
and if the wrapped terrain implements ColorListener, the wrapped piece
will receive the color event as well.
TODO: Unlike agent proxy, this piece cannot augment the flags of the underlying piece... it doesn't look like they would work at all.
| Constructor Summary | |
|---|---|
Decorator(Terrain terrain,
int flags)
|
|
Decorator(Terrain terrain,
int flags,
Color color)
|
|
Decorator(Terrain terrain,
int flags,
Color color,
Symbol symbol)
|
|
Decorator(Terrain terrain,
int flags,
Symbol symbol)
|
|
Decorator(Terrain terrain,
java.lang.String name,
int flags,
Color color,
Symbol symbol)
|
|
| Method Summary | |
|---|---|
boolean |
canEnter(Agent agent,
Cell cell,
Direction direction)
Can the (non-player) agent enter this terrain? Without regard to side effects, this method should determine if the agent can actually move into the cell. |
boolean |
canExit(Agent agent,
Cell cell,
Direction direction)
Can the (non-player) agent exit this terrain? Without regard to side effects, this method should determine if the agent can actually move into the cell. |
Terrain |
getProxiedTerrain()
|
boolean |
is(int flag)
Does this piece have the indicated bit flag? |
boolean |
not(int flag)
Does this piece not have the indicated flag? |
void |
onAdjacentTo(Context context,
Cell cell)
This terrain is adjacent to the player. |
void |
onAgentEnter(Event event,
Agent agent,
Cell cell,
Direction dir)
|
void |
onAgentExit(Event event,
Agent agent,
Cell cell,
Direction dir)
|
void |
onColorEvent(Context ctx,
Cell cell,
Cell origin)
Terrain has received a color event, probably related to the firing of a color event on the board. |
void |
onDrop(Event event,
Cell cell,
Item item)
Item is going to drop onto the terrain at this point. |
void |
onEnter(Event event,
Player player,
Cell cell,
Direction dir)
Agent attempting to leave the from cell, heading
toward the to cell. |
void |
onExit(Event event,
Player player,
Cell cell,
Direction dir)
Agent attempting to exit the from cell, heading
toward the to cell. |
void |
onFlyOver(Event event,
Cell cell,
InFlightItem flier)
Terrain has an item flying over it. |
void |
onNotAdjacentTo(Context context,
Cell cell)
This terrain is no longer adjacent to the player. |
void |
onPickup(Event event,
Cell loc,
Agent agent,
Item item)
Item is going to be picked up. |
| Methods inherited from class us.asciiroth.client.core.AbstractPiece |
|---|
getColor, getName, getSymbol |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface us.asciiroth.client.core.Piece |
|---|
getColor, getName, getSymbol |
| Methods inherited from interface us.asciiroth.client.core.TerrainProxy |
|---|
proxy |
| Constructor Detail |
|---|
public Decorator(Terrain terrain,
int flags)
public Decorator(Terrain terrain,
int flags,
Color color)
public Decorator(Terrain terrain,
int flags,
Color color,
Symbol symbol)
public Decorator(Terrain terrain,
int flags,
Symbol symbol)
public Decorator(Terrain terrain,
java.lang.String name,
int flags,
Color color,
Symbol symbol)
| Method Detail |
|---|
public boolean canEnter(Agent agent,
Cell cell,
Direction direction)
Terrain
canEnter in interface TerrainCell.canEnter(Cell, Agent, Direction, boolean)
public boolean canExit(Agent agent,
Cell cell,
Direction direction)
Terrain
canExit in interface TerrainCell.canEnter(Cell, Agent, Direction, boolean)public Terrain getProxiedTerrain()
getProxiedTerrain in interface TerrainProxypublic boolean is(int flag)
Piece
is in interface Pieceis in class AbstractPieceFlagspublic boolean not(int flag)
Piece
not in interface Piecenot in class AbstractPieceFlags
public void onAdjacentTo(Context context,
Cell cell)
Terrain
onAdjacentTo in interface Terrain
public void onAgentEnter(Event event,
Agent agent,
Cell cell,
Direction dir)
onAgentEnter in interface Terrain
public void onAgentExit(Event event,
Agent agent,
Cell cell,
Direction dir)
onAgentExit in interface Terrain
public void onColorEvent(Context ctx,
Cell cell,
Cell origin)
ColorListener
onColorEvent in interface ColorListenerctx - a context object with references to game state
public void onDrop(Event event,
Cell cell,
Item item)
Terrain
onDrop in interface Terrain
public void onEnter(Event event,
Player player,
Cell cell,
Direction dir)
Terrainfrom cell, heading
toward the to cell. The terrain being used is the
terrain of the to cell. The agent is still in the
from
- Specified by:
onEnter in interface Terrain
public void onExit(Event event,
Player player,
Cell cell,
Direction dir)
Terrainfrom cell, heading
toward the to cell. The terrain being used is the
from cell terrain, and the agent is still in the from
cell. If the event is canceled at this point, the agent will not be able
leave this cell. The move will be canceled. This event is fired for the
player as well as all other agents
onExit in interface Terrain
public void onFlyOver(Event event,
Cell cell,
InFlightItem flier)
Terrain
onFlyOver in interface Terrain
public void onNotAdjacentTo(Context context,
Cell cell)
Terrain
onNotAdjacentTo in interface Terrain
public void onPickup(Event event,
Cell loc,
Agent agent,
Item item)
Terrain
onPickup in interface Terrain
|
0.7 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
© 2009 Alx Dark