us.asciiroth.client.terrain.decorators
Class AgentGate

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

public class AgentGate
extends Decorator

An agent gate decorates another terrain type and changes its behavior so that all agents except the player consider that cell impassable, and will not move through it. This can be used to keep agents in certain areas, if desirable.


Field Summary
static Serializer<AgentGate> SERIALIZER
          Type serializer.
 
Constructor Summary
AgentGate(Terrain terrain)
          Constructor.
 
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 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<AgentGate> SERIALIZER
Type serializer.

Constructor Detail

AgentGate

public AgentGate(Terrain terrain)
Constructor.

Parameters:
terrain -
Method Detail

canEnter

public boolean canEnter(Agent agent,
                        Cell cell,
                        Direction direction)
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 direction)
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)

proxy

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

0.7

© 2009 Alx Dark