gizmoball.gameworld.triggers
Class AnnihilateBothTrigger

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

public class AnnihilateBothTrigger
extends BasicTrigger

A trigger for when a bullet (a ball) hits something else. The bullet always disappears, and the other thing usually gets removed too. Exceptions are the walls, which never get removed, and other ships that it hits (for example, enemy bullets dont kill enemy ships, but if that happens the bullet still dies). This trigger also increments a list of counters when this removal occurs.

Specification Fields

Constructor Summary
AnnihilateBothTrigger(WorldState ws, boolean killgood, java.util.List<Counter> counters)
          Creates the new trigger.
 
Method Summary
 void run(GameObject triggerObject, GameObject otherObject, GameObject triggerObjectCopy, GameObject otherObjectCopy)
          Runs this trigger.
 
Methods inherited from class gizmoball.gameworld.triggers.BasicTrigger
getAssociatedGizmos, priority
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnihilateBothTrigger

public AnnihilateBothTrigger(WorldState ws,
                             boolean killgood,
                             java.util.List<Counter> counters)
Creates the new trigger.

Parameters:
ws - the worldstate that the bullets/destroyed objects will be removed from
killgood - whether or not good ships should be destroyed. if false, this means that enemy ships should be destroyed.
counters - every object that is removed has a certain point value; this is added to all the counters in the list
Method Detail

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
Specified by:
run in class BasicTrigger
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:
removes the ball and possibly the other object involved in the collision