us.asciiroth.client.terrain
Class Cliff

java.lang.Object
  extended by us.asciiroth.client.core.AbstractPiece
      extended by us.asciiroth.client.terrain.decorators.Decorator
          extended by us.asciiroth.client.terrain.Cliff
All Implemented Interfaces:
ColorListener, Piece, Terrain, TerrainProxy

public class Cliff
extends Decorator

Creates a cliff-like version of the terrain where the only way to enter or exit is via another cell that contains the same apparent terrain.


Field Summary
static Serializer<Cliff> SERIALIZER
          Type serializer.
 
Constructor Summary
Cliff(Terrain terrain)
          Constructor.
 
Method Summary
 boolean canEnter(Agent agent, Cell cell, Direction dir)
          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 dir)
          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.
 void onEnterInternal(Event event, Player player, Cell cell, Direction dir)
          Override this method in subclasses in order to augment the onEnter behavior of the decorated terrain.
 void onExitInternal(Event event, Player player, Cell cell, Direction dir)
          Override this method in subclasses in order to augment the onExit behavior of the decorated terrain.
 Terrain proxy(Terrain terrain)
           
 
Methods inherited from class us.asciiroth.client.terrain.decorators.Decorator
getProxiedTerrain, is, not, onAdjacentTo, onAgentEnter, onAgentExit, onColorEvent, onDrop, onEnter, onExit, onFlyOver, onNotAdjacentTo, onPickup
 
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
 

Field Detail

SERIALIZER

public static final Serializer<Cliff> SERIALIZER
Type serializer.

Constructor Detail

Cliff

public Cliff(Terrain terrain)
Constructor.

Parameters:
terrain -
Method Detail

canEnter

public boolean canEnter(Agent agent,
                        Cell cell,
                        Direction dir)
Description copied from interface: Terrain
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. Error on the side of caution and return false if the answer is ambiguous.

Specified by:
canEnter in interface Terrain
Overrides:
canEnter in class Decorator
Returns:
true if the agent can enter the terrain moving between the two cells using the indicated direction
See Also:
Cell.canEnter(Cell, Agent, Direction, boolean)

canExit

public boolean canExit(Agent agent,
                       Cell cell,
                       Direction dir)
Description copied from interface: Terrain
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. Error on the side of caution and return false if the answer is ambiguous.

Specified by:
canExit in interface Terrain
Overrides:
canExit in class Decorator
Returns:
true if the agent can leave this cell going in the indicated direction
See Also:
Cell.canEnter(Cell, Agent, Direction, boolean)

onEnterInternal

public void onEnterInternal(Event event,
                            Player player,
                            Cell cell,
                            Direction dir)
Description copied from class: Decorator
Override this method in subclasses in order to augment the onEnter behavior of the decorated terrain.


onExitInternal

public void onExitInternal(Event event,
                           Player player,
                           Cell cell,
                           Direction dir)
Description copied from class: Decorator
Override this method in subclasses in order to augment the onExit behavior of the decorated terrain.


proxy

public Terrain proxy(Terrain terrain)
Returns:
a new proxy, with the same behavior but wrapping a different terrain

0.7

© 2009 Alx Dark