us.asciiroth.client.terrain
Class AbstractTerrain

java.lang.Object
  extended by us.asciiroth.client.core.AbstractPiece
      extended by us.asciiroth.client.terrain.AbstractTerrain
All Implemented Interfaces:
Piece, Terrain
Direct Known Subclasses:
Altar, BeeHive, Bookshelf, Bridge, BubblingLava, Bushes, CaveEntrance, ChalkedFloor, Chest, Cloud, Crate, Crevasse, Dirt, Door, EuclideanEngine, EuclideanTransporter, Exchanger, FarthapodNest, Field, FishPool, Floor, Flowers, ForceField, Forest, Fountain, Gate, Grass, Haystack, HighRocks, ImpassableCliffs, KeySwitch, Lava, LowRocks, Mud, Ocean, OpeningMarker, Pier, Pit, PressurePlate, Pylon, PyramidWall, Raft, Reflector, RustyGate, Sand, ShallowSwamp, ShallowWater, Shooter, Sky, StairsDown, StairsUp, Swamp, Switch, Teleporter, Throne, TrashPile, Turnstile, Urn, VendingMachine, Wall, Water, Waterfall, Weeds, WishingWell, WoodPiling

public abstract class AbstractTerrain
extends AbstractPiece
implements Terrain

A simple abstract adapter for the terrain interface.


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 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.
 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 onDrop(Event event, Cell itemLoc, 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, is, not
 
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, is, not
 

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
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
Returns:
true if the agent can leave this cell going in the indicated direction
See Also:
Cell.canEnter(Cell, Agent, Direction, boolean)

onAdjacentTo

public void onAdjacentTo(Context context,
                         Cell cell)
Description copied from interface: Terrain
This terrain is adjacent to the player. It may render differently under these circumstances.

Specified by:
onAdjacentTo in interface Terrain

onAgentEnter

public void onAgentEnter(Event event,
                         Agent agent,
                         Cell cell,
                         Direction dir)
Specified by:
onAgentEnter in interface Terrain

onAgentExit

public void onAgentExit(Event event,
                        Agent agent,
                        Cell cell,
                        Direction dir)
Specified by:
onAgentExit in interface Terrain

onDrop

public void onDrop(Event event,
                   Cell itemLoc,
                   Item item)
Description copied from interface: Terrain
Item is going to drop onto the terrain at this point. If the event if canceled at this point, then the item will simply disappear from the board.

Specified by:
onDrop in interface Terrain

onEnter

public void onEnter(Event event,
                    Player player,
                    Cell cell,
                    Direction dir)
Description copied from interface: Terrain
Agent attempting to leave the from 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

onExit

public void onExit(Event event,
                   Player player,
                   Cell cell,
                   Direction dir)
Description copied from interface: Terrain
Agent attempting to exit the from 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

Specified by:
onExit in interface Terrain

onFlyOver

public void onFlyOver(Event event,
                      Cell cell,
                      InFlightItem flier)
Description copied from interface: Terrain
Terrain has an item flying over it. If the event is canceled at this point, the item will fall to the ground on this cell.

Specified by:
onFlyOver in interface Terrain

onNotAdjacentTo

public void onNotAdjacentTo(Context context,
                            Cell cell)
Description copied from interface: Terrain
This terrain is no longer adjacent to the player. It may render differently under these circumstances.

Specified by:
onNotAdjacentTo in interface Terrain

onPickup

public void onPickup(Event event,
                     Cell loc,
                     Agent agent,
                     Item item)
Description copied from interface: Terrain
Item is going to be picked up. If the event is canceled at this point, the item will not be picked up and will remain on the cell.

Specified by:
onPickup in interface Terrain

0.7

2009 Alx Dark