Class ColorRelay

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

public class ColorRelay
extends Decorator

A terrain that looks like the terrain it decorates, and is for all purposes the terrain it looks like, but when it receives a color event, it triggers an event of a different color.

Why is this useful? Let's say you want to have six doors that all open with one key using a key switch. The problem is that the key can only open one door, which will consume it. With a color relay, an orange key switch can trigger an orange color event, and the relay can convert this to another color, let's say a blue color event. Now an orange key can open six blue doors via the orange key switch.

Field Summary
static Serializer<ColorRelay> SERIALIZER
          Type serializer.
Method Summary
 void onColorEventInternal(Context ctx, Cell cell, Cell origin)
          Override this method in subclasses in order to augment the onTrigger behavior of the decorated terrain.
 Terrain proxy(Terrain terrain)
Methods inherited from class us.asciiroth.client.terrain.decorators.Decorator
canEnter, canExit, 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


public static final Serializer<ColorRelay> SERIALIZER
Type serializer.

Method Detail


public void onColorEventInternal(Context ctx,
                                 Cell cell,
                                 Cell origin)
Description copied from class: Decorator
Override this method in subclasses in order to augment the onTrigger behavior of the decorated terrain.


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


2009 Alx Dark