de.rico.adventure.script.trigger
Class RectTriggerArea

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

public class RectTriggerArea
extends AbstractTrigger

This class represents a rectangular trigger area.

Author:
Frank Bruns

Constructor Summary
RectTriggerArea(java.lang.String scriptId, float x, float z, float width, float length)
          Creates a new rectangular trigger area with no candidates for firering the trigger initially assigned.
RectTriggerArea(java.lang.String scriptId, float x, float z, float width, float length, AbstractCharacter c)
          Creates a new rectangular trigger area with the specified character as the only one that can fire the trigger.
RectTriggerArea(java.lang.String scriptId, float x, float z, float width, float length, java.util.List<AbstractCharacter> candiates)
          Creates a new rectangular 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 getLength()
          Returns the length of the trigger area.
 float getWidth()
          Returns the width of the trigger area.
 boolean isCandiateOnTrigger()
          Determines if at least one candiate character is within the trigger area.
 void setLength(float length)
          Sets a new length for the trigger area.
 void setWidth(float width)
          Sets a new width 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

RectTriggerArea

public RectTriggerArea(java.lang.String scriptId,
                       float x,
                       float z,
                       float width,
                       float length)
Creates a new rectangular 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
width - width of the trigger reactangle
length - height of the trigger reactangle

RectTriggerArea

public RectTriggerArea(java.lang.String scriptId,
                       float x,
                       float z,
                       float width,
                       float length,
                       AbstractCharacter c)
Creates a new rectangular 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
width - width of the trigger rectangle
length - height of the trigger reactangle
c - only character that can fire the trigger

RectTriggerArea

public RectTriggerArea(java.lang.String scriptId,
                       float x,
                       float z,
                       float width,
                       float length,
                       java.util.List<AbstractCharacter> candiates)
Creates a new rectangular 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
width - width of the trigger rectangle
length - length of the trigger reactangle
candiates - candiates for firering the trigger
Method Detail

getWidth

public float getWidth()
Returns the width of the trigger area.

Returns:
width of the trigger area

setWidth

public void setWidth(float width)
Sets a new width for the trigger area.

Parameters:
width - new width for the trigger

getLength

public float getLength()
Returns the length of the trigger area.

Returns:
length of the trigger area

setLength

public void setLength(float length)
Sets a new length for the trigger area.

Parameters:
length - new length 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