Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10698 in orxonox.OLD for trunk/src/world_entities/world_entity.h


Ignore:
Timestamp:
Jun 14, 2007, 5:33:43 PM (17 years ago)
Author:
snellen
Message:

merged adm, hud, vs-enhancements : beni's responsible for this commit. blame him!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/world_entity.h

    r10540 r10698  
    161161  void increaseHealthMax(float increaseHealth);
    162162  OrxGui::GLGuiWidget* getHealthWidget();
     163  OrxGui::GLGuiWidget* getImplantWidget();
     164  OrxGui::GLGuiWidget* getShieldWidget();
     165  OrxGui::GLGuiWidget* getElectronicWidget();
    163166  bool hasHealthWidget() const { return this->healthWidget != NULL; };
     167
     168  float getShield() const { return this->shield; };
     169  float getShieldMax() const { return this->shieldMax; };
     170  float increaseShield(float shield);
     171  float decreaseShield(float shield);
     172  bool getShieldActive() { return this->bShieldActive; };
     173
     174  float getElectronic() const { return this->electronic; };
     175  float getElectronicMax() const { return this->electronicMax; };
     176  float increaseElectronic(float electronic);
     177  float decreaseElectronic(float electronic);
     178
     179  bool systemFailure() {  return (this->electronic < float(rand())/float(RAND_MAX) * this->electronicTH); };
     180
     181  void resetElectronic() { this->electronic = this->electronicMax; };
     182  void resetShield()  { this->shield = this->shieldMax; this->bShieldActive = true; };
     183  void resetHealth() { this->health = this->healthMax; };
     184
     185  void createHealthWidget();
     186  void createShieldWidget();
     187  void createElectronicWidget();
     188
     189  void regen(float time);
     190
     191  void loadShield(float cur, float max, float th, float regen)
     192      { this->setShield(cur); this->setShieldMax(max); this->setShieldTH(th); this->setShieldRegen(regen); };
     193  void loadHealth(float cur, float max, float regen = 0) { this->setHealth(cur); this->setHealthMax(max); this->setHealthRegen(regen); };
     194  void loadElectronic(float cur, float max, float th, float regen)
     195      { this->setElectronic(cur); this->setElectronicMax(max); this->setElectronicTH(th); this->setElectronicRegen(regen); };
     196
    164197
    165198  virtual void varChangeHandler( std::list<int> & id );
     
    181214  void pauseTrack(bool stop);
    182215
     216//   void updateHealthWidget();
     217//   void updateElectronicWidget();
     218//   void updateShieldWidget();
    183219
    184220protected:
    185   void setHealth(float health) { this->health = health; this->updateHealthWidget();};
    186   void setHealthWidgetVisibilit(bool visibility);
     221  inline void setHealth(float health) { this->health = health; this->updateHealthWidget();};
     222  void setHealthWidgetVisibility(bool visibility);
    187223  void setHealthMax(float healthMax);
    188   void createHealthWidget();
     224//   void createHealthWidget();
     225//   void createShieldWidget();
     226//   void createElectronicWidget();
     227  void setHealthRegen(float regen) { this->healthRegen = regen; };
     228  void createImplantWidget();
    189229    //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
     230
     231  void setShield(float shield) { this->shield = shield; };
     232  void setShieldMax(float shield) { this->shieldMax = shield; };
     233  void setShieldTH(float th) { this->shieldTH = th; };
     234  void setShieldRegen(float regen) { this->shieldRegen = regen; };
     235  void setShieldActive(bool active) { this->bShieldActive = active; };
     236
     237  void setElectronic(float electronic) { this->electronic = electronic; };
     238  void setElectronicMax(float electronic) { this->electronicMax = electronic; };
     239  void setElectronicTH(float th) { this->electronicTH = th; };
     240  void setElectronicRegen(float regen) { this->electronicRegen = regen; };
    190241
    191242  inline void drawDebugTrack(int flag) { this->bDrawTrack = (bool)flag; }
    192243  inline bool isDrawTrack() const { return this->bDrawTrack; }
    193244
    194 
    195245private:
    196246  void updateHealthWidget();
     247  void updateElectronicWidget();
     248  void updateShieldWidget();
    197249  void addTrack(const TiXmlElement* root);
    198250
    199251
    200252
    201   protected:
    202       std::vector<MountPoint*> mountPoints;       //!< A list with mount points for this model
    203       std::map<int, MountPoint*> mountPointMap;
     253protected:
     254  std::vector<MountPoint*> mountPoints;       //!< A list with mount points for this model
     255  std::map<int, MountPoint*> mountPointMap;
    204256
    205257
    206258
    207259private:
    208   /// TODO maybe we will move the following three entries and the corresponding functions to Playable AND NPC
     260
     261  //!< TODO maybe we will move the following three entries and the corresponding functions to Playable AND NPC
     262  //!< started transfering shield/electronic/health from spaceship to WE! (nico, 4.Jun.07)
     263
    209264  float                   damage;             //!< the damage dealt to other objects by colliding.
    210265  float                   health;             //!< The Energy of this Entity, if the Entity has any energy at all.
    211   float                   healthMax;          //!< The Maximal energy this entity can take.
     266  float                   healthMax;          //!< The Maximal energy this entity can take.
     267  float                                         implantEnergy;          //!< energy of implants
     268  float                   healthRegen;        //!< Regeneration Rate of Health, mesured in units per second
    212269  OrxGui::GLGuiEnergyWidgetVertical* healthWidget;    //!< The Slider (if wanted).
     270  OrxGui::GLGuiEnergyWidgetVertical* implantWidget;
     271
     272  float       shield;             //!< current shield
     273  float       shieldMax;          //!< maximum shield
     274  float       shieldRegen;        //!< shield regeneration rate per second
     275  float       shieldTH;           //!< shield threshhold for reactivation
     276  bool        bShieldActive;      //!< wheather the shield is working
     277  OrxGui::GLGuiEnergyWidgetVertical* shieldWidget; //!< holds the widget that shows the shield bar
     278
     279  float       electronic;         //!< current electronic
     280  float       electronicMax;      //!< maximum electronic
     281  float       electronicRegen;    //!< electronic regenration rate per tick
     282  float       electronicTH;       //!< Threshhold for electronic failure
     283  OrxGui::GLGuiEnergyWidgetVertical* electronicWidget; //!< holds the widget that shows the electronic bar
     284
    213285
    214286  std::vector<Model*>     models;             //!< The model that should be loaded for this entity.
     
    247319  float                   healthMax_write;
    248320  int                     healthMax_handle;
     321 
     322
    249323
    250324
Note: See TracChangeset for help on using the changeset viewer.