Changeset 10739 for code/branches/fabienHS15/src/orxonox
- Timestamp:
- Nov 1, 2015, 1:05:54 PM (9 years ago)
- Location:
- code/branches/fabienHS15/src/orxonox/worldentities/pawns
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.cc
r10692 r10739 61 61 62 62 this->bAlive_ = true; 63 this->b Reload_ = false;63 this->bShieldRecharging_ = false; 64 64 65 65 this->health_ = 0; … … 72 72 this->shieldAbsorption_ = 0.5; 73 73 74 this-> reloadRate_ = 0;75 this-> reloadWaitTime_ = 1.0f;76 this-> reloadWaitCountdown_ = 0;74 this->shieldRechargeRate_ = 0; 75 this->shieldRechargeWaitTime_ = 1.0f; 76 this->shieldRechargeWaitCountdown_ = 0; 77 77 78 78 this->lastHitOriginator_ = 0; … … 143 143 XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode); 144 144 145 XMLPortParam(Pawn, "reloadrate", set ReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);146 XMLPortParam(Pawn, "reloadwaittime", set ReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);145 XMLPortParam(Pawn, "reloadrate", setShieldRechargeRate, getShieldRechargeRate, xmlelement, mode).defaultValues(0); 146 XMLPortParam(Pawn, "reloadwaittime", setShieldRechargeWaitTime, getShieldRechargeWaitTime, xmlelement, mode).defaultValues(1.0f); 147 147 148 148 XMLPortParam(Pawn, "explosionSound", setExplosionSound, getExplosionSound, xmlelement, mode); … … 159 159 registerVariable(this->maxShieldHealth_, VariableDirection::ToClient); 160 160 registerVariable(this->shieldAbsorption_, VariableDirection::ToClient); 161 registerVariable(this->b Reload_, VariableDirection::ToServer);161 registerVariable(this->bShieldRecharging_, VariableDirection::ToServer); 162 162 registerVariable(this->aimPosition_, VariableDirection::ToServer); // For the moment this variable gets only transfered to the server 163 163 } … … 167 167 SUPER(Pawn, tick, dt); 168 168 169 this->b Reload_ = false;169 this->bShieldRecharging_ = false; 170 170 171 171 // 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();172 if(this->shieldRechargeWaitCountdown_ > 0) 173 { 174 this->decreaseShieldRechargeCountdownTime(dt); 175 } 176 else 177 { 178 this->addShieldHealth(this->getShieldRechargeRate() * dt); 179 this->resetShieldRechargeCountdown(); 180 180 } 181 181 … … 229 229 } 230 230 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;231 void Pawn::setShieldRechargeRate(float shieldRechargeRate) 232 { 233 this->shieldRechargeRate_ = shieldRechargeRate; 234 } 235 236 void Pawn::setShieldRechargeWaitTime(float shieldRechargeWaitTime) 237 { 238 this->shieldRechargeWaitTime_ = shieldRechargeWaitTime; 239 } 240 241 void Pawn::decreaseShieldRechargeCountdownTime(float dt) 242 { 243 this->shieldRechargeWaitCountdown_ -= dt; 244 244 } 245 245 … … 482 482 void Pawn::reload() 483 483 { 484 this->b Reload_ = true;484 this->bShieldRecharging_ = true; 485 485 } 486 486 -
code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.h
r10692 r10739 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); … … 210 207 virtual void spawneffect(); 211 208 212 //virtual void damage(float damage, Pawn* originator = 0);213 209 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL); 214 210 … … 229 225 float initialShieldHealth_; 230 226 float shieldAbsorption_; ///< Has to be between 0 and 1 231 float reloadRate_;232 float reloadWaitTime_;233 float reloadWaitCountdown_;227 float shieldRechargeRate_; 228 float shieldRechargeWaitTime_; 229 float shieldRechargeWaitCountdown_; 234 230 235 231 float damageMultiplier_; ///< Used by the Damage Boost Pickup. … … 238 234 239 235 WeaponSystem* weaponSystem_; 240 bool b Reload_;236 bool bShieldRecharging_; 241 237 242 238 std::string spawnparticlesource_;
Note: See TracChangeset
for help on using the changeset viewer.