moagg.model.weapon
Class SingleFireStrategy

java.lang.Object
  extended by moagg.model.weapon.SingleFireStrategy
All Implemented Interfaces:
FireStrategy, Weapon

public class SingleFireStrategy
extends java.lang.Object
implements FireStrategy

This fire strategy is firing only one shot when the "fire button" is pressed.


Constructor Summary
SingleFireStrategy()
           
 
Method Summary
 boolean isShoot()
          Called by the game control (via the game object) in each frame.
 void setShoot(boolean shoot)
          Normally this method is called by the game object in each frame.
protected  void setState(moagg.model.weapon.SingleFireStrategy.State state)
           
 void update(long elapsedTime)
          Must be called by the game object for each frame, since weapon implementations may have internal timers of some kind.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleFireStrategy

public SingleFireStrategy()
Method Detail

setState

protected void setState(moagg.model.weapon.SingleFireStrategy.State state)

update

public void update(long elapsedTime)
Description copied from interface: Weapon
Must be called by the game object for each frame, since weapon implementations may have internal timers of some kind.

Specified by:
update in interface Weapon

isShoot

public boolean isShoot()
Description copied from interface: Weapon
Called by the game control (via the game object) in each frame. This method must not modify the internal state of the weapon, because it might be called multiple times by the game control.

Specified by:
isShoot in interface Weapon
Returns:
true if a shot shall be fired, else false.

setShoot

public void setShoot(boolean shoot)
Description copied from interface: Weapon
Normally this method is called by the game object in each frame.

Specified by:
setShoot in interface Weapon
Parameters:
shoot - true if the "fire button is pressed", else false.


Copyright © 2008. All Rights Reserved.