gizmoball.gameworld.triggers
Class GroupTrigger

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

public class GroupTrigger
extends java.lang.Object
implements Trigger

A GroupTrigger runs an underlying trigger only when each of a set of ToggleGizmos is on.

Specification Fields

Constructor Summary
GroupTrigger(Trigger trigger, java.util.Set<ToggleGizmo> gizmos, java.util.List<Trigger> resetTriggers)
          Creates a new GroupTrigger with the given parameters
 
Method Summary
 void addTrigger(Trigger t)
           
 java.util.List<Gizmo> getAssociatedGizmos()
          A GroupTrigger has the same associated Gizmos as the underlying Trigger
 double priority()
          A GroupTrigger has the same priority as the underlying 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

GroupTrigger

public GroupTrigger(Trigger trigger,
                    java.util.Set<ToggleGizmo> gizmos,
                    java.util.List<Trigger> resetTriggers)
Creates a new GroupTrigger with the given parameters

Parameters:
trigger -
gizmos -
resetTriggers -
Method Detail

getAssociatedGizmos

public java.util.List<Gizmo> getAssociatedGizmos()
A GroupTrigger has the same associated Gizmos as the underlying Trigger

Specified by:
getAssociatedGizmos in interface Trigger
Returns:
this.trigger.asssociatedGizmos

priority

public double priority()
A GroupTrigger has the same priority as the underlying Trigger

Specified by:
priority in interface Trigger
Returns:
this.trigger.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:
runs if each ToggleGizmo in gizmos is on, does nothing otherwise

addTrigger

public void addTrigger(Trigger t)
Effects:
t is added to resetTriggers