|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectus.asciiroth.client.terrain.decorators.DualTerrain
public class DualTerrain
Dual terrain is a composite terrain that holds two other terrains,
only one of which is active at any given time. It is not a decorator,
insofar as it doesn't change the behavior of either terrain (except for
the ColorListener interface which it implements: color events
will switch the dual terrain, and if the newly activated terrain implements
the ColorListener interface, it will fire that as well). The
inactive terrain is simply ignored, but knowledge of its presence at the
given cell continues to exist.
The DualTerrain exposes a method, switchTerrains(), that will
change the current terrain, and the onTrigger() method will
do this as well.
DualTerrain does implement TerrainProxy so that
in the map editor, it is correctly marked as a compound-style terrain
(otherwise it would be indistinguishable from its active terrain).
NOTE: If one of the included terrains transforms a cell, it will wipe out the DualTerrain.
| Field Summary | |
|---|---|
static Serializer<DualTerrain> |
SERIALIZER
Type serializer. |
| 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. |
Color |
getColor()
What is the color of this piece? While many piece types are permanently of color "None", many more can be parameterized with a color in order to tie them together through color-based events. |
java.lang.String |
getName()
The visible name of the piece. |
Terrain |
getProxiedTerrain()
|
Symbol |
getSymbol()
The symbol to display for this piece. |
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. |
Terrain |
proxy(Terrain terrain)
Will create a proxy with the terrain replacing the currently active terrain. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Serializer<DualTerrain> SERIALIZER
| 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 Color getColor()
Piece
getColor in interface Piecepublic java.lang.String getName()
Piece
getName in interface Piecepublic Terrain getProxiedTerrain()
getProxiedTerrain in interface TerrainProxypublic Symbol getSymbol()
Piece
getSymbol in interface Piecepublic boolean is(int flag)
Piece
is in interface PieceFlagspublic boolean not(int flag)
Piece
not in interface PieceFlags
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 Terrainpublic Terrain proxy(Terrain terrain)
proxy in interface TerrainProxy
|
0.7 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
© 2009 Alx Dark