de.rico.adventure.script.trigger
Class CircleTriggerArea

java.lang.Object
  extended by de.rico.adventure.script.trigger.AbstractTrigger
      extended by de.rico.adventure.script.trigger.CircleTriggerArea

public class CircleTriggerArea
extends AbstractTrigger

This class represents a circular trigger area.

Author:
Frank Bruns

Constructor Summary
CircleTriggerArea(java.lang.String scriptId, float x, float z, float radius)
          Creates a new circular trigger area with no candidates for firering the trigger initially assigned.
CircleTriggerArea(java.lang.String scriptId, float x, float z, float radius, AbstractCharacter c)
          Creates a new circular trigger area with the specified character as the only one that can fire the trigger.
CircleTriggerArea(java.lang.String scriptId, float x, float z, float radius, java.util.List<AbstractCharacter> candiates)
          Creates a new circular trigger area with the specified list of characters that can fire the trigger.
 
Method Summary
 void draw(javax.media.opengl.GL gl)
          Draws the trigger area to the ground.
 float getRadius()
          Returns the radius of the trigger area.
 boolean isCandiateOnTrigger()
          Determines if at least one candiate character is within the trigger area.
 void setRadius(float radius)
          Sets a new radius for the trigger area.
 void update(long elapsedTime)
          This method updates the special things of the circular trigger area and calls the update() method of the super class AbstractTrigger.update(long), too.
 
Methods inherited from class de.rico.adventure.script.trigger.AbstractTrigger
addCandidate, getCandidates, getColor, getScriptId, getX, getZ, hasBeenCalledEnterMethod, hasBeenCalledExitMethod, isEnabled, removeCandidate, setCalledEnterMethod, setCalledExitMethod, setColor, setEnabled, setPosition, setScriptId, setX, setZ
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CircleTriggerArea

public CircleTriggerArea(java.lang.String scriptId,
                         float x,
                         float z,
                         float radius)
Creates a new circular trigger area with no candidates for firering the trigger initially assigned.

Parameters:
scriptId - id for reference purposes in script files
x - x-coordinate of the trigger center
z - z-coordinate of the trigger center
radius - radius of the trigger circle

CircleTriggerArea

public CircleTriggerArea(java.lang.String scriptId,
                         float x,
                         float z,
                         float radius,
                         AbstractCharacter c)
Creates a new circular trigger area with the specified character as the only one that can fire the trigger.

Parameters:
scriptId - id for reference purposes in script files
x - x-coordinate of the trigger center
z - z-coordinate of the trigger center
radius - radius of the trigger circle
c - only character that can fire the trigger

CircleTriggerArea

public CircleTriggerArea(java.lang.String scriptId,
                         float x,
                         float z,
                         float radius,
                         java.util.List<AbstractCharacter> candiates)
Creates a new circular trigger area with the specified list of characters that can fire the trigger.

Parameters:
scriptId - id for reference purposes in script files
x - x-coordinate of the trigger center
z - z-coordinate of the trigger center
radius - radius of the trigger circle
candiates - candiates for firering the trigger
Method Detail

getRadius

public float getRadius()
Returns the radius of the trigger area.

Returns:
radius of the trigger area

setRadius

public void setRadius(float radius)
Sets a new radius for the trigger area.

Parameters:
radius - new radius for the trigger

isCandiateOnTrigger

public boolean isCandiateOnTrigger()
Description copied from class: AbstractTrigger
Determines if at least one candiate character is within the trigger area.

Specified by:
isCandiateOnTrigger in class AbstractTrigger
Returns:
is character on trigger? --> true=yes, false=no

draw

public void draw(javax.media.opengl.GL gl)
Description copied from class: AbstractTrigger
Draws the trigger area to the ground.

Specified by:
draw in class AbstractTrigger

update

public void update(long elapsedTime)
This method updates the special things of the circular trigger area and calls the update() method of the super class AbstractTrigger.update(long), too.

Overrides:
update in class AbstractTrigger
Parameters:
elapsedTime - time between two frames