- Timestamp:
- Dec 9, 2015, 2:45:58 PM (9 years ago)
- Location:
- code/branches/presentationHS15
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentationHS15
- Property svn:mergeinfo changed
/code/branches/fabienHS15 (added) merged: 10685,10688,10692,10713-10715,10721,10724,10739,10746,10791,10794-10795,10814,10842,10878
- Property svn:mergeinfo changed
-
code/branches/presentationHS15/src/orxonox/worldentities/MobileEntity.h
r10437 r10961 47 47 linear velocity. Then the linear velocity is multiplied by the time since the last call of tick and then added to the position. The same happens with 48 48 the angular acceleration and velocity. With this procedure MobileEntities can change their position and orientation with time. 49 50 A MobileEntity can only have the collisition type WorldEntity::None, WorldEntity::Dynamic or WorldEntity::Kinematic. The collsion type WorldEntity::Static is illegal. 49 51 */ 50 52 -
code/branches/presentationHS15/src/orxonox/worldentities/StaticEntity.h
r10437 r10961 44 44 it is called StaticEntity. It will keep the same position (always with respect to its parent) forever unless you call the 45 45 function @see setPosition to changee it. 46 47 A StaticEntity can only have the collisition type WorldEntity::None or WorldEntity::Static. The collsion types WorldEntity::Dynamic and WorldEntity::Kinematic are illegal. 46 48 */ 47 49 -
code/branches/presentationHS15/src/orxonox/worldentities/pawns/Pawn.cc
r10650 r10961 46 46 #include "weaponsystem/WeaponPack.h" 47 47 #include "weaponsystem/WeaponSet.h" 48 #include "weaponsystem/Munition.h" 48 49 #include "sound/WorldSound.h" 49 50 … … 61 62 62 63 this->bAlive_ = true; 63 this->bReload_ = false;64 64 65 65 this->health_ = 0; … … 71 71 this->maxShieldHealth_ = 100; //otherwise shield might increase to float_max 72 72 this->shieldAbsorption_ = 0.5; 73 74 this->reloadRate_ = 0; 75 this->reloadWaitTime_ = 1.0f; 76 this->reloadWaitCountdown_ = 0; 73 this->shieldRechargeRate_ = 0; 74 this->shieldRechargeWaitTime_ = 1.0f; 75 this->shieldRechargeWaitCountdown_ = 0; 77 76 78 77 this->lastHitOriginator_ = 0; … … 141 140 XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode); 142 141 XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode); 143 XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode); 144 145 XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0); 146 XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f); 142 XMLPortObject(Pawn, WeaponPack, "weaponpacks", addWeaponPackXML, getWeaponPack, xmlelement, mode); 143 XMLPortObject(Pawn, Munition, "munition", addMunitionXML, getMunitionXML, xmlelement, mode); 144 145 XMLPortParam(Pawn, "shieldrechargerate", setShieldRechargeRate, getShieldRechargeRate, xmlelement, mode).defaultValues(0); 146 XMLPortParam(Pawn, "shieldrechargewaittime", setShieldRechargeWaitTime, getShieldRechargeWaitTime, xmlelement, mode).defaultValues(1.0f); 147 147 148 148 XMLPortParam(Pawn, "explosionSound", setExplosionSound, getExplosionSound, xmlelement, mode); … … 153 153 void Pawn::registerVariables() 154 154 { 155 registerVariable(this->bAlive_, VariableDirection::ToClient); 156 registerVariable(this->health_, VariableDirection::ToClient); 157 registerVariable(this->maxHealth_, VariableDirection::ToClient); 158 registerVariable(this->shieldHealth_, VariableDirection::ToClient); 159 registerVariable(this->maxShieldHealth_, VariableDirection::ToClient); 160 registerVariable(this->shieldAbsorption_, VariableDirection::ToClient); 161 registerVariable(this->bReload_, VariableDirection::ToServer); 162 registerVariable(this->aimPosition_, VariableDirection::ToServer); // For the moment this variable gets only transfered to the server 155 registerVariable(this->bAlive_, VariableDirection::ToClient); 156 registerVariable(this->health_, VariableDirection::ToClient); 157 registerVariable(this->maxHealth_, VariableDirection::ToClient); 158 registerVariable(this->shieldHealth_, VariableDirection::ToClient); 159 registerVariable(this->maxShieldHealth_, VariableDirection::ToClient); 160 registerVariable(this->shieldAbsorption_, VariableDirection::ToClient); 161 registerVariable(this->aimPosition_, VariableDirection::ToServer); // For the moment this variable gets only transfered to the server 163 162 } 164 163 … … 167 166 SUPER(Pawn, tick, dt); 168 167 169 this->bReload_ = false; 170 168 // Recharge the shield 171 169 // TODO: use the existing timer functions instead 172 if(this-> reloadWaitCountdown_ > 0)173 { 174 this->decrease ReloadCountdownTime(dt);175 } 176 else 177 { 178 this->addShieldHealth(this->get ReloadRate() * dt);179 this->reset ReloadCountdown();170 if(this->shieldRechargeWaitCountdown_ > 0) 171 { 172 this->decreaseShieldRechargeCountdownTime(dt); 173 } 174 else 175 { 176 this->addShieldHealth(this->getShieldRechargeRate() * dt); 177 this->resetShieldRechargeCountdown(); 180 178 } 181 179 … … 229 227 } 230 228 231 void Pawn::set ReloadRate(float reloadrate)232 { 233 this-> reloadRate_ = reloadrate;234 } 235 236 void Pawn::set ReloadWaitTime(float reloadwaittime)237 { 238 this-> reloadWaitTime_ = reloadwaittime;239 } 240 241 void Pawn::decrease ReloadCountdownTime(float dt)242 { 243 this-> reloadWaitCountdown_ -= dt;229 void Pawn::setShieldRechargeRate(float shieldRechargeRate) 230 { 231 this->shieldRechargeRate_ = shieldRechargeRate; 232 } 233 234 void Pawn::setShieldRechargeWaitTime(float shieldRechargeWaitTime) 235 { 236 this->shieldRechargeWaitTime_ = shieldRechargeWaitTime; 237 } 238 239 void Pawn::decreaseShieldRechargeCountdownTime(float dt) 240 { 241 this->shieldRechargeWaitCountdown_ -= dt; 244 242 } 245 243 … … 252 250 if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator)) 253 251 { 252 // Health-damage cannot be absorbed by shields. 253 // Shield-damage only reduces shield health. 254 // Normal damage can be (partially) absorbed by shields. 255 254 256 if (shielddamage >= this->getShieldHealth()) 255 257 { … … 480 482 } 481 483 482 void Pawn::reload()483 {484 this->bReload_ = true;485 }486 487 484 void Pawn::postSpawn() 488 485 { … … 554 551 } 555 552 553 std::vector<WeaponPack *> * Pawn::getAllWeaponPacks() 554 { 555 if (this->weaponSystem_) 556 return this->weaponSystem_->getAllWeaponPacks(); 557 else 558 return 0; 559 } 560 561 void Pawn::addMunitionXML(Munition* munition) 562 { 563 if (this->weaponSystem_ && munition) 564 { 565 this->weaponSystem_->addMunition(munition); 566 } 567 } 568 569 Munition* Pawn::getMunitionXML() const 570 { 571 return NULL; 572 } 573 574 Munition* Pawn::getMunition(SubclassIdentifier<Munition> * identifier) 575 { 576 if (weaponSystem_) 577 { 578 return weaponSystem_->getMunition(identifier); 579 } 580 581 return NULL; 582 } 583 556 584 //Tell the Map (RadarViewable), if this is a playership 557 585 void Pawn::startLocalHumanControl() 558 586 { 559 // SUPER(ControllableEntity, changedPlayer());587 // SUPER(ControllableEntity, startLocalHumanControl()); 560 588 ControllableEntity::startLocalHumanControl(); 561 589 this->isHumanShip_ = true; -
code/branches/presentationHS15/src/orxonox/worldentities/pawns/Pawn.h
r10437 r10961 42 42 /** 43 43 @brief 44 Everything in Orxono ythat has a health attribute is a Pawn. After a Pawn is spawned its health is set to44 Everything in Orxonox that has a health attribute is a Pawn. After a Pawn is spawned its health is set to 45 45 its initial health. In every call of the Pawns tick function the game checks whether the pawns health is at 46 46 or below zero. If it is, the pawn gets killed. 47 47 48 Pawns can carry pickups and fire weapons. The can also have shields.48 Pawns can carry pickups and fire weapons. They can also have shields. 49 49 50 50 Notice that every Pawn is a ControllableEntity. … … 116 116 { return this->shieldAbsorption_; } 117 117 118 // TODO: Rename to shieldRechargeRate 119 virtual void setReloadRate(float reloadrate); 120 inline float getReloadRate() const 121 { return this->reloadRate_; } 122 123 virtual void setReloadWaitTime(float reloadwaittime); 124 inline float getReloadWaitTime() const 125 { return this->reloadWaitTime_; } 126 127 inline void resetReloadCountdown() 128 { this->reloadWaitCountdown_ = 0; } 129 130 inline void startReloadCountdown() 131 { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } // TODO: Implement in Projectile.cc 132 133 virtual void decreaseReloadCountdownTime(float dt); 118 virtual void setShieldRechargeRate(float shieldRechargeRate); 119 inline float getShieldRechargeRate() const 120 { return this->shieldRechargeRate_; } 121 122 virtual void setShieldRechargeWaitTime(float shieldRechargeWaitTime); 123 inline float getShieldRechargeWaitTime() const 124 { return this->shieldRechargeWaitTime_; } 125 126 inline void resetShieldRechargeCountdown() 127 { this->shieldRechargeWaitCountdown_ = 0; } 128 129 inline void startShieldRechargeCountdown() 130 { this->shieldRechargeWaitCountdown_ = this->getShieldRechargeWaitTime(); } // TODO: Implement in Projectile.cc 131 132 virtual void decreaseShieldRechargeCountdownTime(float dt); 134 133 135 134 inline ControllableEntity* getLastHitOriginator() const 136 135 { return this->lastHitOriginator_; } 137 136 138 //virtual void hit(Pawn* originator, const Vector3& force, float damage);139 //virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);140 137 virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f); 141 138 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f); … … 144 141 145 142 virtual void fired(unsigned int firemode); 146 virtual void reload();147 143 virtual void postSpawn(); 148 144 … … 154 150 void addWeaponPackXML(WeaponPack * wPack); 155 151 WeaponPack * getWeaponPack(unsigned int index) const; 152 std::vector<WeaponPack *> * getAllWeaponPacks(); 153 154 void addMunitionXML(Munition* munition); 155 Munition* getMunitionXML() const; 156 157 Munition* getMunition(SubclassIdentifier<Munition> * identifier); 156 158 157 159 virtual void addedWeaponPack(WeaponPack* wPack) {} … … 207 209 virtual void spawneffect(); 208 210 209 //virtual void damage(float damage, Pawn* originator = 0);210 211 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL); 211 212 … … 226 227 float initialShieldHealth_; 227 228 float shieldAbsorption_; ///< Has to be between 0 and 1 228 float reloadRate_;229 float reloadWaitTime_;230 float reloadWaitCountdown_;229 float shieldRechargeRate_; 230 float shieldRechargeWaitTime_; 231 float shieldRechargeWaitCountdown_; 231 232 232 233 float damageMultiplier_; ///< Used by the Damage Boost Pickup. … … 235 236 236 237 WeaponSystem* weaponSystem_; 237 bool bReload_;238 238 239 239 std::string spawnparticlesource_; -
code/branches/presentationHS15/src/orxonox/worldentities/pawns/SpaceShip.cc
r10216 r10961 297 297 } 298 298 } 299 300 void SpaceShip::gainBoostPower(float gainedBoostPower) 301 { 302 this->boostPower_ += gainedBoostPower; 303 304 if (this->boostPower_ > this->initialBoostPower_) 305 { 306 this->boostPower_ = this->initialBoostPower_; 307 } 308 309 // If the booster is in cooldown mode and we gained boost power, the abort the cooldown. 310 if (this->isBoostCoolingDown() && this->boostPower_ > 0.0f) 311 { 312 timer_.stopTimer(); 313 this->boostCooledDown(); 314 } 315 } 316 299 317 /** 300 318 @brief -
code/branches/presentationHS15/src/orxonox/worldentities/pawns/SpaceShip.h
r10437 r10961 53 53 - The <b>boost</b>, there are quite some parameters pertaining to boosting. The boost is a special move of the SpaceShip, where, for a limited amount of time, it can fly considerably faster than usual. The <b>boostPower</b> is the amount of power available for boosting. The <b>boostPowerRate</b> is the rate at which the boost power is replenished. The <b>boostRate</b> is the rate at which boosting uses power. And the <b>boostCooldownDuration</b> is the time the SpaceShip cannot boost, once all the boost power has been used up. Naturally all of these parameters must be non-negative. 54 54 - The <b>boost shaking</b>, when the SpaceShip boosts, the camera shakes to create a more immersive effect. Two parameters can be used to adjust the effect. The <b>shakeFrequency</b> is the frequency with which the camera shakes. And the <b>shakeAmplitude</b> is the amount with which the camera shakes. Again these parameters must bee non-negative. 55 - The <b>lift</b> creates a more natural flight feeling through the addition of a lift force. There are again tow parameters that can be specified. The <b>lift</b> which is the lift force that is applied. And the <b>stallSpeed</b> which is the forward speed after which no more lift is generated. 55 - The <b>lift</b> creates a more natural flight feeling through the addition of a lift force. There are again two parameters that can be specified. The <b>lift</b> which is the lift force that is applied. And the <b>stallSpeed</b> which is the forward speed after which no more lift is generated. 56 57 A spaceship always needs to have the collision type "dynamic". Other collision types are illegal. 56 58 57 59 As mentioned @ref orxonox::Engine Engines can be mounted on the SpaceShip. Here is a (primitive) example of a SpaceShip defined in XML: … … 250 252 inline float getShakeAmplitude() const 251 253 { return this->shakeAmplitude_; } 254 /** 255 @brief Add boost power. Is non-negative. 256 @return Returns the current boost power. 257 */ 258 void gainBoostPower(float gainedBoostPower); 252 259 253 260 protected: … … 262 269 bool bBoostCooldown_; //!< Whether the SpaceShip is currently in boost cooldown, during which boosting is impossible. 263 270 float initialBoostPower_; //!< The initial (and maximal) boost power. 264 float boostPower_; //!< The current boost power. 271 float boostPower_; //!< The current boost power. If the boost power is reduced to zero the boost cooldown will start. 265 272 float boostPowerRate_; //!< The rate at which the boost power is recharged. 266 273 float boostRate_; //!< The rate at which boost power is used up. … … 289 296 std::vector<Engine*> engineList_; //!< The list of all Engines mounted on this SpaceShip. 290 297 291 Timer timer_; //!< Timer for the cooldown duration.298 Timer timer_; //!< Timer for the cooldown of the boost. 292 299 float shakeDt_; //!< Temporary variable for the shaking of the camera. 293 300 Vector3 cameraOriginalPosition_; //!< The original position of the camera before shaking it.
Note: See TracChangeset
for help on using the changeset viewer.