Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 5, 2007, 2:48:15 PM (17 years ago)
Author:
nicolasc
Message:

moved "ship attributes" to world entity
electronic and shield widget not yet working

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/vs-enhencements/src/world_entities/world_entity.h

    r10669 r10670  
    161161  void increaseHealthMax(float increaseHealth);
    162162  OrxGui::GLGuiWidget* getHealthWidget();
     163  OrxGui::GLGuiWidget* getShieldWidget();
     164  OrxGui::GLGuiWidget* getElectronicWidget();
    163165  bool hasHealthWidget() const { return this->healthWidget != NULL; };
    164166
     167  float getShield() const { return this->shield; };
     168  float getShieldMax() const { return this->shieldMax; };
     169  float increaseShield(float shield);
     170  float decreaseShield(float shield);
     171  bool getShieldActive() { return this->bShieldActive; };
     172
     173  float getElectronic() const { return this->electronic; };
     174  float getElectronicMax() const { return this->electronicMax; };
     175  float increaseElectronic(float electronic);
     176  float decreaseElectronic(float electronic);
     177
     178  bool systemFailure() {  return (this->electronic < float(rand())/float(RAND_MAX) * this->electronicTH); };
     179
     180  void resetElectronic() { this->electronic = this->electronicMax; };
     181  void resetShield()  { this->shield = this->shieldMax; this->bShieldActive = true; };
     182  void resetHealth() { this->health = this->healthMax; };
     183
     184
     185  void regen(float time);
     186
     187  void loadShield(float cur, float max, float th, float regen)
     188      { this->setShield(cur); this->setShieldMax(max); this->setShieldTH(th); this->setShieldRegen(regen); };
     189  void loadHealth(float cur, float max, float regen = 0) { this->setHealth(cur); this->setHealthMax(max); this->setHealthRegen(regen); };
     190  void loadElectronic(float cur, float max, float th, float regen)
     191      { this->setElectronic(cur); this->setElectronicMax(max); this->setElectronicTH(th); this->setElectronicRegen(regen); };
     192/*
     193  OrxGui::GLGuiEnergyWidgetVertical* getHealthWidget() { return this->healthWidget; };
     194  OrxGui::GLGuiEnergyWidgetVertical* getShieldWidget() { return this->shieldWidget; };
     195  OrxGui::GLGuiEnergyWidgetVertical* getEnergyWidget() { return this->electronicWidget; };*/
     196
     197
    165198  virtual void varChangeHandler( std::list<int> & id );
     199
     200
    166201
    167202
     
    181216  void pauseTrack(bool stop);
    182217
     218//   void updateHealthWidget();
     219//   void updateElectronicWidget();
     220//   void updateShieldWidget();
    183221
    184222protected:
    185   void setHealth(float health) { this->health = health; this->updateHealthWidget();};
    186   void setHealthWidgetVisibilit(bool visibility);
     223  inline void setHealth(float health) { this->health = health; this->updateHealthWidget();};
     224  void setHealthWidgetVisibility(bool visibility);
    187225  void setHealthMax(float healthMax);
    188226  void createHealthWidget();
     227  void createShieldWidget();
     228  void createElectronicWidget();
     229  void setHealthRegen(float regen) { this->healthRegen = regen; };
    189230    //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
     231
     232  void setShield(float shield) { this->shield = shield; };
     233  void setShieldMax(float shield) { this->shieldMax = shield; };
     234  void setShieldTH(float th) { this->shieldTH = th; };
     235  void setShieldRegen(float regen) { this->shieldRegen = regen; };
     236  void setShieldActive(bool active) { this->bShieldActive = active; };
     237
     238  void setElectronic(float electronic) { this->electronic = electronic; };
     239  void setElectronicMax(float electronic) { this->electronicMax = electronic; };
     240  void setElectronicTH(float th) { this->electronicTH = th; };
     241  void setElectronicRegen(float regen) { this->electronicRegen = regen; };
    190242
    191243  inline void drawDebugTrack(int flag) { this->bDrawTrack = (bool)flag; }
    192244  inline bool isDrawTrack() const { return this->bDrawTrack; }
    193245
    194 
    195246private:
    196247  void updateHealthWidget();
     248  void updateElectronicWidget();
     249  void updateShieldWidget();
    197250  void addTrack(const TiXmlElement* root);
    198251
     
    206259
    207260private:
    208   /// TODO maybe we will move the following three entries and the corresponding functions to Playable AND NPC
     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)
    209263  float                   damage;             //!< the damage dealt to other objects by colliding.
    210264  float                   health;             //!< The Energy of this Entity, if the Entity has any energy at all.
    211265  float                   healthMax;          //!< The Maximal energy this entity can take.
     266  float                   healthRegen;        //!< Regeneration Rate of Health, mesured in units per second
    212267  OrxGui::GLGuiEnergyWidgetVertical* healthWidget;    //!< The Slider (if wanted).
     268
     269  float       shield;             //!< current shield
     270  float       shieldMax;          //!< maximum shield
     271  float       shieldRegen;        //!< shield regeneration rate per second
     272  float       shieldTH;           //!< shield threshhold for reactivation
     273  bool        bShieldActive;      //!< wheather the shield is working
     274  OrxGui::GLGuiEnergyWidgetVertical* shieldWidget; //!< holds the widget that shows the shield bar
     275
     276  float       electronic;         //!< current electronic
     277  float       electronicMax;      //!< maximum electronic
     278  float       electronicRegen;    //!< electronic regenration rate per tick
     279  float       electronicTH;       //!< Threshhold for electronic failure
     280  OrxGui::GLGuiEnergyWidgetVertical* electronicWidget; //!< holds the widget that shows the electronic bar
     281
    213282
    214283  std::vector<Model*>     models;             //!< The model that should be loaded for this entity.
Note: See TracChangeset for help on using the changeset viewer.