Changeset 10698 in orxonox.OLD for trunk/src/world_entities/world_entity.h
- Timestamp:
- Jun 14, 2007, 5:33:43 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/world_entity.h
r10540 r10698 161 161 void increaseHealthMax(float increaseHealth); 162 162 OrxGui::GLGuiWidget* getHealthWidget(); 163 OrxGui::GLGuiWidget* getImplantWidget(); 164 OrxGui::GLGuiWidget* getShieldWidget(); 165 OrxGui::GLGuiWidget* getElectronicWidget(); 163 166 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 164 197 165 198 virtual void varChangeHandler( std::list<int> & id ); … … 181 214 void pauseTrack(bool stop); 182 215 216 // void updateHealthWidget(); 217 // void updateElectronicWidget(); 218 // void updateShieldWidget(); 183 219 184 220 protected: 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); 187 223 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(); 189 229 // 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; }; 190 241 191 242 inline void drawDebugTrack(int flag) { this->bDrawTrack = (bool)flag; } 192 243 inline bool isDrawTrack() const { return this->bDrawTrack; } 193 244 194 195 245 private: 196 246 void updateHealthWidget(); 247 void updateElectronicWidget(); 248 void updateShieldWidget(); 197 249 void addTrack(const TiXmlElement* root); 198 250 199 251 200 252 201 202 203 253 protected: 254 std::vector<MountPoint*> mountPoints; //!< A list with mount points for this model 255 std::map<int, MountPoint*> mountPointMap; 204 256 205 257 206 258 207 259 private: 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 209 264 float damage; //!< the damage dealt to other objects by colliding. 210 265 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 212 269 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 213 285 214 286 std::vector<Model*> models; //!< The model that should be loaded for this entity. … … 247 319 float healthMax_write; 248 320 int healthMax_handle; 321 322 249 323 250 324
Note: See TracChangeset
for help on using the changeset viewer.