moagg.model.weapon
Class WeaponDecorator

java.lang.Object
  extended by moagg.model.weapon.WeaponDecorator
All Implemented Interfaces:
Weapon
Direct Known Subclasses:
BackDecorator, DoubleDecorator, TripleDecorator

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

Weapon implementations may be enhanced by decorators extending this class.


Constructor Summary
protected WeaponDecorator()
           
protected WeaponDecorator(Weapon weapon)
           
 
Method Summary
 Weapon getWeapon()
           
 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.
 void setWeapon(Weapon weapon)
           
 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

WeaponDecorator

protected WeaponDecorator()

WeaponDecorator

protected WeaponDecorator(Weapon weapon)
Method Detail

setWeapon

public void setWeapon(Weapon weapon)

getWeapon

public Weapon getWeapon()

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.

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


Copyright © 2008. All Rights Reserved.