gizmoball.gameworld.triggers
Class ActivateGizmoTrigger

java.lang.Object
  extended by gizmoball.gameworld.triggers.ActivateGizmoTrigger
All Implemented Interfaces:
Trigger

public class ActivateGizmoTrigger
extends java.lang.Object
implements Trigger

This trigger activates a specified Gizmo.

Specification Fields :
gizmo : Gizmo // the activated gizmo

Constructor Summary
ActivateGizmoTrigger(Gizmo g)
          Creates a new ActivateGizmoTrigger, that activates the gizmo g when run.
ActivateGizmoTrigger(Gizmo g, double priority)
          Creates a new ActivateGizmoTrigger with a specified priority (a higher priority means it gets run later).
 
Method Summary
 java.util.List<Gizmo> getAssociatedGizmos()
          Gets all the gizmos that are associated with this trigger; ie all the gizmos that this trigger must keep an internal reference to.
 GameObject getGizmo()
           
 double priority()
          The priority of this trigger.
 void run(GameObject triggerObject, GameObject otherObject, GameObject triggerObjectCopy, GameObject otherObjectCopy)
          Runs this trigger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivateGizmoTrigger

public ActivateGizmoTrigger(Gizmo g)
Creates a new ActivateGizmoTrigger, that activates the gizmo g when run. The default priority is 0.


ActivateGizmoTrigger

public ActivateGizmoTrigger(Gizmo g,
                            double priority)
Creates a new ActivateGizmoTrigger with a specified priority (a higher priority means it gets run later).

Method Detail

priority

public double priority()
Description copied from interface: Trigger
The priority of this trigger. Higher priority means that the effects of this trigger are more important, and will overwrite effects of lower-priority triggers.

Specified by:
priority in interface Trigger
Returns:
this.priority

run

public void run(GameObject triggerObject,
                GameObject otherObject,
                GameObject triggerObjectCopy,
                GameObject otherObjectCopy)
Description copied from interface: Trigger
Runs this trigger. Reads from the first two arguments, writes to the second two arguments.

Specified by:
run in interface Trigger
Parameters:
triggerObject - the GameObject that is linked to this trigger
otherObject - the other GameObject that was involved in this event
triggerObjectCopy - a copy that should be modified
otherObjectCopy - a copy that should be modified
Effects:
activates this.gizmo

getGizmo

public GameObject getGizmo()
Returns:
this.gizmo

getAssociatedGizmos

public java.util.List<Gizmo> getAssociatedGizmos()
Description copied from interface: Trigger
Gets all the gizmos that are associated with this trigger; ie all the gizmos that this trigger must keep an internal reference to.

Specified by:
getAssociatedGizmos in interface Trigger
Returns:
a list with this.gizmo