public abstract class BasicTile extends Object implements Tile
Tile that provides the
base for PassableTile, ImpassableTile, etc. It
maintains the rule that only one character and one item may be on the
tile at any time.| Modifier | Constructor and Description |
|---|---|
protected |
BasicTile(int tileTypeId)
Creates an instance of
BasicTile. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addCharacter(CharacterManager mgr)
Adds the given character to this tile if possible.
|
boolean |
addItem(Item item)
Adds the given item to this tile if possible.
|
boolean |
canOccupy(CharacterManager mgr)
Checks if the there is anything currently occupying this tile that
would keep the character from occupying it.
|
protected LevelBoard.ActionResult |
charMoveTo(CharacterManager characterManager)
Test to move the given character to this tile.
|
int |
getID()
Returns the identifier for this tile.
|
int[] |
getIdStack()
Returns a stack of identifiers, specifying everything on this
Tile. |
LevelBoard.ActionResult |
getItem(CharacterManager characterManager)
Tries to take an item on this tile.
|
boolean |
removeCharacter(CharacterManager mgr)
Removes the given character from this tile, if and only if this
character is already on this tile.
|
boolean |
removeItem(Item item)
Removes the given item from this tile, if and only if this item
is already on this tile.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisPassable, moveToprotected BasicTile(int tileTypeId)
BasicTile.id - the tile's identifierpublic int getID()
public int[] getIdStack()
Tile.getIdStack in interface Tilepublic boolean canOccupy(CharacterManager mgr)
public boolean addCharacter(CharacterManager mgr)
addCharacter in interface TilemgrRef - the manager for a characterpublic boolean removeCharacter(CharacterManager mgr)
removeCharacter in interface TilemgrRef - the manager for a characterpublic boolean addItem(Item item)
public boolean removeItem(Item item)
removeItem in interface Tileitem - the itemprotected LevelBoard.ActionResult charMoveTo(CharacterManager characterManager)
characterManager - the manager for a characterpublic LevelBoard.ActionResult getItem(CharacterManager characterManager)
moveTo,
this actually will remove items from the tile if they are
successfully taken.Copyright © 2013. All Rights Reserved.