예제 #1
0
  /**
   * Called by the widget body to signal something.
   *
   * @param event one of the WidgetBody.SIGNAL_* constants.
   * @param extra some Object relevant to the event. SIGNAL_TARGET for example should also pass a
   *     Point3f
   */
  protected void handleWidgetEvent(int event, Object extra) {
    switch (event) {
      case WidgetBody.TARGET:
        if (fWidgetOwner.getCurrentWidget() == this)
          fWidgetOwner.setHUDTarget(this, (Point3f) extra);
        break;

      case WidgetBody.DESTROYED:
      case WidgetBody.TERMINATED:
        dispose();
        break;
    }
  }
예제 #2
0
 /**
  * Get the health of the widget.
  *
  * @return float
  */
 public float getHealth() {
   return fWidgetOwner.getHealth();
 }
예제 #3
0
 /**
  * Get how much energy the player has.
  *
  * @return float
  */
 public float getEnergy() {
   return fWidgetOwner.getEnergy();
 }
예제 #4
0
 /** Dispose of the widget. */
 public void dispose() {
   // let the owner know we're going away
   fWidgetOwner.widgetDisposed(this);
   fWidgetOwner.removePlayerStateListener(this);
 }
예제 #5
0
 /**
  * Add a damage listener to the player.
  *
  * @param dl q2java.baseq2.event.DamageListener
  */
 public void addDamageListener(DamageListener dl) {
   fWidgetOwner.addDamageListener(dl);
 }
예제 #6
0
  /**
   * Set the player who made this.
   *
   * @param w barryp.widgetwar.WidgetWarrior
   */
  public void setWidgetOwner(WidgetWarrior w) {
    fWidgetOwner = w;

    // register to be called if the player disconnects
    w.addPlayerStateListener(this);
  }
예제 #7
0
 /**
  * Set the health of the widget.
  *
  * @param f float
  */
 public void setHealth(float f) {
   fWidgetOwner.setHealth(f);
 }
예제 #8
0
 /**
  * Set how much energy the player has.
  *
  * @param f float
  */
 public void setEnergy(float f) {
   fWidgetOwner.setEnergy(f);
 }
예제 #9
0
 /**
  * Remove a DamageListener from the player.
  *
  * @param dl q2java.baseq2.event.DamageListener
  */
 public void removeDamageListener(DamageListener dl) {
   fWidgetOwner.removeDamageListener(dl);
 }