de.rico.adventure.entity.hotspot
Class AbstractInteractiveHotspot

java.lang.Object
  extended by de.rico.adventure.entity.AbstractEntity
      extended by de.rico.adventure.entity.hotspot.AbstractInteractiveHotspot
Direct Known Subclasses:
CubicalHotpot, SphericalHotspot

public abstract class AbstractInteractiveHotspot
extends AbstractEntity

This abstract class represents an interactive hotspot in the game. Interactives hotspot are invisible volumes that can behave interactively. You can specify, if items can be applied to the hotspot or if the hotspot can be used without an item (such as light switches).

Author:
Frank Bruns

Constructor Summary
AbstractInteractiveHotspot(Point3D pos, boolean needsItem)
          Creates a new interactive hotspot at the specified position.
 
Method Summary
 void destroy()
          This method does have no effect on interactive hotspots
abstract  void draw(javax.media.opengl.GL gl)
          Visualizes the interactive hotspot.
 AbstractMesh getMesh()
          Interactive hotspots don't have meshes assignes, so this method always returns null.
abstract  Point3D getMouseOverHotspot(int screenX, int screenY)
          Returns the world coordinates of the mouse position over the hotspot.
 Point3D getPosition()
          Returns the position of the interactive hotspot.
 boolean isEnabled()
          Determines whether or not the interactive hotspot is enabled.
abstract  boolean isMouseOverHotspot(int screenX, int screenY)
          Determines whether the mouse is located over the interactive hotspot.
abstract  boolean isWithinFrustum(ViewingFrustum frustum)
          Determines whether or not the hotspot volume is within the camera's viewing frustum.
 boolean needsItem()
          Determines whether or not the hotspot needs an item to be useable.
 void setEnabled(boolean enable)
          Sets whether or not this hotspot is enabled.
 void setNeedsItem(boolean needsItem)
          Set whether or not the hotspot needs an item applied to be useable.
 void setPosition(Point3D pos)
          Sets the position of the interactive hotspot.
 java.lang.String toString()
           
 
Methods inherited from class de.rico.adventure.entity.AbstractEntity
drawScreenName, getScreenName, getScriptId, setScreenName, setScriptId
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractInteractiveHotspot

public AbstractInteractiveHotspot(Point3D pos,
                                  boolean needsItem)
Creates a new interactive hotspot at the specified position. You can specify, if items can be applied to the hotspot or if the hotspot can be used without an item (such as light switches).

Parameters:
pos - position of the hotspot
needsItem - needs item to use? --> true=yes, false=no
Method Detail

getPosition

public Point3D getPosition()
Returns the position of the interactive hotspot.

Returns:
position of the interactive hotspot

setPosition

public void setPosition(Point3D pos)
Sets the position of the interactive hotspot.

Parameters:
pos - position of the hotspot

setNeedsItem

public void setNeedsItem(boolean needsItem)
Set whether or not the hotspot needs an item applied to be useable.

Parameters:
needsItem - needs an item? --> true=yes, false=no

needsItem

public boolean needsItem()
Determines whether or not the hotspot needs an item to be useable.

Returns:
needs item? --> true=yes, false=no

isEnabled

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

Overrides:
isEnabled in class AbstractEntity
Returns:
is enabled? --> true=yes, false=no

setEnabled

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

Overrides:
setEnabled in class AbstractEntity
Parameters:
enable - set enabled? --> true=yes, false=no

destroy

public void destroy()
This method does have no effect on interactive hotspots

Overrides:
destroy in class AbstractEntity

getMesh

public AbstractMesh getMesh()
Interactive hotspots don't have meshes assignes, so this method always returns null.

Overrides:
getMesh in class AbstractEntity
Returns:
the mesh for the entity

toString

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

isMouseOverHotspot

public abstract boolean isMouseOverHotspot(int screenX,
                                           int screenY)
Determines whether the mouse is located over the interactive hotspot.

Parameters:
screenX - screen x-coordinate
screenY - screen y-coordinate
Returns:
is mouse on hotspot? --> true=yes, false=no

getMouseOverHotspot

public abstract Point3D getMouseOverHotspot(int screenX,
                                            int screenY)
Returns the world coordinates of the mouse position over the hotspot.

Parameters:
screenX - screen x-coordinate
screenY - screen y-coordinate
Returns:
world position of the mouse over the hotspot

isWithinFrustum

public abstract boolean isWithinFrustum(ViewingFrustum frustum)
Determines whether or not the hotspot volume is within the camera's viewing frustum.

Parameters:
frustum - the camera's viewing frustum
Returns:
is in frustum? --> true=yes, false=no

draw

public abstract void draw(javax.media.opengl.GL gl)
Visualizes the interactive hotspot.

Parameters:
gl -