moagg.model.weapon
Class AbstractWeapon

java.lang.Object
  extended by moagg.model.weapon.AbstractWeapon
All Implemented Interfaces:
Weapon
Direct Known Subclasses:
AbstractBarrel, AbstractBarrel, Blaster, Blaster, Laser, Laser, MissileLauncher

public abstract class AbstractWeapon
extends java.lang.Object
implements Weapon

This is an abstract implementation of a weapon delegating the having the ability to inject a fire strategy.


Constructor Summary
AbstractWeapon()
           
 
Method Summary
 boolean isShoot()
          Called by the game control (via the game object) in each frame.
 void setFireStrategy(FireStrategy fireStrategy)
           
 void setShoot(boolean shoot)
          Normally this method is called by the game object in each frame.
 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

AbstractWeapon

public AbstractWeapon()
Method Detail

setFireStrategy

public void setFireStrategy(FireStrategy fireStrategy)

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.