de.rico.adventure.entity.character
Class PlayableCharacter

java.lang.Object
  extended by de.rico.adventure.entity.AbstractEntity
      extended by de.rico.adventure.entity.character.AbstractCharacter
          extended by de.rico.adventure.entity.character.PlayableCharacter

public class PlayableCharacter
extends AbstractCharacter

Class for playable characters.

Author:
Frank Bruns

Constructor Summary
PlayableCharacter(AbstractMesh mesh, AbstractInventory inventory)
          Creates a new playable character that uses the specified mesh as a model and the specified inventory system for its items.
 
Method Summary
 AbstractInventory getInventory()
          Returns the inventory of the character.
 Room getPreviousRoom()
          Returns the room the player previously visited.
 void pickUp(Item item)
          This method picks up an item and adds it to the playable character's inventory.
 void setInventory(AbstractInventory inventory)
          Sets the inventory system of the character.
 void setPreviousRoom(Room room)
          Sets the room that was previously visited by the player.
 boolean uses(Item item)
          Determines whether or not the specified item is equal to the one that is currently selected from the inventory.
 
Methods inherited from class de.rico.adventure.entity.character.AbstractCharacter
getRoom, say, say, setRoom
 
Methods inherited from class de.rico.adventure.entity.AbstractEntity
destroy, drawScreenName, getMesh, getScreenName, getScriptId, isEnabled, setEnabled, setScreenName, setScriptId, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlayableCharacter

public PlayableCharacter(AbstractMesh mesh,
                         AbstractInventory inventory)
Creates a new playable character that uses the specified mesh as a model and the specified inventory system for its items.

Parameters:
mesh - mesh to use as a model
inventory - inventory system for the character
Method Detail

getPreviousRoom

public Room getPreviousRoom()
Returns the room the player previously visited. This information can be important in MAP mode.

Returns:
previously by the player visited room

setPreviousRoom

public void setPreviousRoom(Room room)
Sets the room that was previously visited by the player.

Parameters:
room - room that was previously visited by the player

setInventory

public void setInventory(AbstractInventory inventory)
Sets the inventory system of the character.

Parameters:
inventory - inventory system for the character

getInventory

public AbstractInventory getInventory()
Returns the inventory of the character.

Returns:
inventory of the character

pickUp

public void pickUp(Item item)
This method picks up an item and adds it to the playable character's inventory.

Parameters:
item - item to pick up and add to the inventory

uses

public boolean uses(Item item)
Determines whether or not the specified item is equal to the one that is currently selected from the inventory.

Parameters:
item - item to checked for being currently used.
Returns:
is item equal to currently used inventor item? --> true=yes, false=no