- Timestamp:
- May 26, 2016, 4:53:34 PM (8 years ago)
- Location:
- code/branches/presentationFS16
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentationFS16
- Property svn:mergeinfo changed
/code/branches/sagerjFS16 (added) merged: 11138,11142,11153,11164,11166,11170,11174-11175,11185,11189,11205
- Property svn:mergeinfo changed
-
code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponMode.cc
r11108 r11208 24 24 * Fabian 'x3n' Landau 25 25 * Co-authors: 26 * ...26 * Johannes Sager 27 27 * 28 28 */ … … 63 63 this->bAutoReload_ = true; 64 64 this->bParallelReload_ = true; 65 this->chargeable_ = false; // most weapons are not chargeable 66 this->charges_ = 0; // always start with no charges 67 this->maxCharges_ = 100; // default maximum charges one can have are 100 65 68 66 69 this->reloadTimer_.setTimer(0.0f, false, createExecutor(createFunctor(&WeaponMode::reloaded, this))); … … 121 124 { 122 125 (*reloadTime) = this->reloadTime_; 123 124 126 // Fireing is only possible if this weapon mode is not reloading and there is enough munition 125 127 if (!this->bReloading_ && this->munition_ && this->munition_->takeMunition(this->munitionPerShot_, this)) … … 169 171 } 170 172 173 bool WeaponMode::push(float* reloadTime) 174 { 175 176 if( this->chargeable_) // chargeable weapons are supposed to charge on push 177 { 178 this->munition_ = this->weapon_->getWeaponPack()->getWeaponSystem()->getMunition(&this->munitiontype_); // updates the pointer to the munition(which we use in the next step) 179 if(this->charges_ < this->maxCharges_ && this->bReloading_ == false && this->munition_->canTakeMunition(1, this)) // charges up unless: 180 { // - we are fully charged 181 this->charges_ += 1; // - we are reloading 182 } // - we have no munition 183 return false; 184 } 185 else // normal (not chargeable) weapons are supposed to fire on push 186 { 187 return fire(reloadTime); 188 } 189 } 190 191 bool WeaponMode::release(float* reloadTime) 192 { 193 if( this->chargeable_) // chargeable weapons are supposed to fire on release 194 { 195 return fire(reloadTime); 196 } 197 else // normal (not chargeable) weapons should do nothing on release 198 { 199 return false; 200 } 201 } 202 171 203 bool WeaponMode::reload() 172 204 {
Note: See TracChangeset
for help on using the changeset viewer.