gizmoball.gameworld.triggers
Class BreakGizmoTrigger

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

public class BreakGizmoTrigger
extends java.lang.Object
implements Trigger

A trigger that slowly breaks a gizmo. The amount of brokenness is stored in the gizmo color.

Specification Fields :
ws : WorldState // the world that this is eventually removed from

Constructor Summary
BreakGizmoTrigger(WorldState ws)
          Creates a new BreakGizmoTrigger.
 
Method Summary
 java.util.List<Gizmo> getAssociatedGizmos()
          A BreakGizmoTrigger has no assocated gizmos
 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

BreakGizmoTrigger

public BreakGizmoTrigger(WorldState ws)
Creates a new BreakGizmoTrigger.

Parameters:
ws - the WorldState that the gizmos should be removed from.
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:
either increments the gizmo color or removes the gizmo, depending on the color

getAssociatedGizmos

public java.util.List<Gizmo> getAssociatedGizmos()
A BreakGizmoTrigger has no assocated gizmos

Specified by:
getAssociatedGizmos in interface Trigger
Returns:
an empty list