org.deken.game.trigger
Class LocationTrigger

java.lang.Object
  extended by org.deken.game.trigger.Trigger
      extended by org.deken.game.trigger.LocationTrigger
All Implemented Interfaces:
Updateable

public class LocationTrigger
extends Trigger

Title: LocationTrigger

Description: This class watches an Actor, and fires off when the Actor reaches certain locations. This trigger is set to check for an exact tile location. Setting the exact to false, will cause this trigger to fire off if the Actor is only within the tile.

Copyright: Copyright (c) Sep 1, 2012

Version:
1.0
Author:
Gary Deken

Nested Class Summary
 
Nested classes/interfaces inherited from class org.deken.game.trigger.Trigger
Trigger.TRIGGER_TIMES
 
Field Summary
 
Fields inherited from class org.deken.game.trigger.Trigger
activated
 
Constructor Summary
LocationTrigger(Actor watch, int[] tileXY, MapSize mapSize)
           
LocationTrigger(Actor watch, int tileX, int tileY, MapSize mapSize)
           
LocationTrigger(Actor watch, MapSize mapSize)
           
 
Method Summary
 void checkTrigger(long elapseTime)
          Checks if the Actor is at the location, and if so, triggers the listeners, then stops this trigger from executing again.
 void reset()
          Resets this Trigger so that it can be invoked again.
 void setTileXY(int[] tileXY)
          Set the tile locations, to watch if the Actor lands on them.
 
Methods inherited from class org.deken.game.trigger.Trigger
activateListeners, addListener, deactivateListeners, getName, removeListener, setName, setTimesActivated, setTimesActivated, stopTrigger, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocationTrigger

public LocationTrigger(Actor watch,
                       MapSize mapSize)
Parameters:
watch -
mapSize -

LocationTrigger

public LocationTrigger(Actor watch,
                       int tileX,
                       int tileY,
                       MapSize mapSize)
Parameters:
watch -
tileX -
tileY -
mapSize -

LocationTrigger

public LocationTrigger(Actor watch,
                       int[] tileXY,
                       MapSize mapSize)
Parameters:
watch -
tileXY -
mapSize -
Method Detail

checkTrigger

public void checkTrigger(long elapseTime)
Checks if the Actor is at the location, and if so, triggers the listeners, then stops this trigger from executing again.

Specified by:
checkTrigger in class Trigger
Parameters:
elapseTime -

reset

public void reset()
Description copied from class: Trigger
Resets this Trigger so that it can be invoked again.

Overrides:
reset in class Trigger

setTileXY

public void setTileXY(int[] tileXY)
Set the tile locations, to watch if the Actor lands on them.

Parameters:
tileXY -