- Timestamp:
- Nov 1, 2015, 1:05:54 PM (9 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.