de.rico.adventure.entity
Class AbstractEntity

java.lang.Object
  extended by de.rico.adventure.entity.AbstractEntity
Direct Known Subclasses:
AbstractCharacter, AbstractInteractiveHotspot, Item, Prop

public abstract class AbstractEntity
extends java.lang.Object

This is the abstract base class for all entities (game objects) in the game.

Author:
Frank Bruns

Constructor Summary
AbstractEntity(AbstractMesh mesh)
          Creates a new entity with the specified mesh as a model
 
Method Summary
 void destroy()
          Destroys the entity and releases its resources.
 void drawScreenName(int screenX, int screenY)
          Draws the description of the character at the specified screen position.
 AbstractMesh getMesh()
          Returns the mesh that is used for this entity.
 java.lang.String getScreenName()
          Returns the entity's screen name.
 java.lang.String getScriptId()
          Returns the reference id for this entity which is used in a script file.
 boolean isEnabled()
          Determines whether or not the entity is enabled.
 void setEnabled(boolean enable)
          Sets whether or not this entity is enabled.
 void setScreenName(java.lang.String name)
          Sets the screen name of the entity.
 void setScriptId(java.lang.String id)
          Sets the identifier that can be used to refer to this entity in a script file.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractEntity

public AbstractEntity(AbstractMesh mesh)
Creates a new entity with the specified mesh as a model

Parameters:
mesh - mesh to use as a model for the entity
Method Detail

setScreenName

public void setScreenName(java.lang.String name)
Sets the screen name of the entity. The name must be unique for all the entities.

Parameters:
name - screen name of the entity

getScreenName

public java.lang.String getScreenName()
Returns the entity's screen name.

Returns:
screen name of the entity

getMesh

public AbstractMesh getMesh()
Returns the mesh that is used for this entity.

Returns:
the mesh for the entity

getScriptId

public java.lang.String getScriptId()
Returns the reference id for this entity which is used in a script file.

Returns:
reference id in a script file
Throws:
java.lang.NullPointerException - Occurs when no id has been specified for the entity.

setScriptId

public void setScriptId(java.lang.String id)
Sets the identifier that can be used to refer to this entity in a script file.

Parameters:
id - reference id in a script file

isEnabled

public boolean isEnabled()
Determines whether or not the entity is enabled.

Returns:
is enabled? --> true=yes, false=no

setEnabled

public void setEnabled(boolean enable)
Sets whether or not this entity is enabled.

Parameters:
enable - set enabled? --> true=yes, false=no

drawScreenName

public void drawScreenName(int screenX,
                           int screenY)
Draws the description of the character at the specified screen position.

Parameters:
screenX - x-coordinate on the screen
screenY - y-coordinate on the screen

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

destroy

public void destroy()
Destroys the entity and releases its resources.