示例#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);
 }