Changeset 11174 for code/branches/sagerjFS16
- Timestamp:
- Apr 21, 2016, 4:47:39 PM (9 years ago)
- Location:
- code/branches/sagerjFS16/src
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.cc
r11170 r11174 54 54 this->damage_ = 90.01f; 55 55 this->speed_ = 90.01f; 56 this->charge s_ = 0;56 this->chargeable_ = 0; 57 57 58 58 this->setMunitionName("LaserMunition"); … … 65 65 void Discharger::fire() 66 66 { 67 charges_ += 1; 68 orxout() << "c = " << charges_ << endl; 69 } 70 71 void Discharger::release() 72 { 73 orxout() << "release c = " << charges_ << endl; 67 orxout() << "release" << cTime_ << endl; 74 68 BillboardProjectile* projectile = new BillboardProjectile(this->getContext()); 75 69 -
code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.h
r11170 r11174 48 48 @ingroup WeaponsWeaponModes 49 49 */ 50 50 51 class _WeaponsExport Discharger : public WeaponMode 51 52 { … … 55 56 56 57 virtual void fire() override; 57 virtual void release() override;58 58 59 59 private: 60 float speed_; // The speed of the fired projectile. 61 unsigned int charges_; // An indicator of how much you charged up. 60 bool chargeable_; // An indicator that this weapon type is chargeable. 61 float speed_; // The speed of the fired projectile. 62 float ctime_; // time the weapon has charged. 62 63 }; 63 64 } -
code/branches/sagerjFS16/src/orxonox/controllers/HumanController.cc
r11170 r11174 40 40 namespace orxonox 41 41 { 42 extern const std::string __CC_ fire_name = "fire";42 extern const std::string __CC_push_name = "push"; 43 43 extern const std::string __CC_suicide_name = "suicide"; 44 44 extern const std::string __CC_release_name = "release"; … … 52 52 SetConsoleCommand("HumanController", "toggleFormationFlight", &HumanController::toggleFormationFlight).addShortcut().keybindMode(KeybindMode::OnPress); 53 53 SetConsoleCommand("HumanController", "FFChangeMode", &HumanController::FFChangeMode).addShortcut().keybindMode(KeybindMode::OnPress); 54 SetConsoleCommand("HumanController", __CC_ fire_name, &HumanController::fire).addShortcut().keybindMode(KeybindMode::OnHold);54 SetConsoleCommand("HumanController", __CC_push_name, &HumanController::push ).addShortcut().keybindMode(KeybindMode::OnHold); 55 55 SetConsoleCommand("HumanController", __CC_release_name, &HumanController::release ).addShortcut().keybindMode(KeybindMode::OnRelease); 56 56 SetConsoleCommand("HumanController", "reload", &HumanController::reload ).addShortcut(); … … 157 157 } 158 158 159 void HumanController:: fire(unsigned int firemode)160 { 161 if (HumanController::localController_s) 162 HumanController::localController_s->do Fire(firemode);163 } 164 165 void HumanController::do Fire(unsigned int firemode)166 { 167 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 168 { 169 HumanController::localController_s->controllableEntity_-> fire(firemode);159 void HumanController::push(unsigned int firemode) 160 { 161 if (HumanController::localController_s) 162 HumanController::localController_s->doPush(firemode); 163 } 164 165 void HumanController::doPush(unsigned int firemode) 166 { 167 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 168 { 169 HumanController::localController_s->controllableEntity_->push(firemode); 170 170 //if human fires, set slaves free. See FormationController::forceFreeSlaves() 171 171 if (HumanController::localController_s->state_==MASTER && HumanController::localController_s->formationMode_ == NORMAL) -
code/branches/sagerjFS16/src/orxonox/controllers/HumanController.h
r11164 r11174 61 61 virtual void pitch(const Vector2& value); 62 62 63 static void fire(unsigned int firemode);64 virtual void do Fire(unsigned int firemode);63 static void push(unsigned int firemode); 64 virtual void doPush(unsigned int firemode); 65 65 static void release(unsigned int firemode); 66 66 virtual void doRelease(unsigned int firemode); -
code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.cc
r11170 r11174 276 276 } 277 277 278 void NewHumanController::do Fire(unsigned int firemode)278 void NewHumanController::doPush(unsigned int firemode) 279 279 { 280 280 if (!this->controllableEntity_) … … 291 291 else 292 292 { 293 HumanController::do Fire(firemode); //call for formationflight293 HumanController::doPush(firemode); //call for formationflight 294 294 } 295 295 } -
code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.h
r11166 r11174 54 54 static void decelerate(); 55 55 56 virtual void do Fire(unsigned int firemode) override;56 virtual void doPush(unsigned int firemode) override; 57 57 virtual void doRelease(unsigned int firemode) override; 58 58 -
code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.cc
r11170 r11174 99 99 Fire this Weapon with the the WeaponMode defined by @param mode 100 100 */ 101 void Weapon:: fire(unsigned int mode)101 void Weapon::push(unsigned int mode) 102 102 { 103 103 // To avoid firing with more than one mode at the same time, we lock the weapon (reloading) for … … 125 125 { 126 126 float reloading_time = 0; 127 if (it->second-> fire(&reloading_time))127 if (it->second->push(&reloading_time)) 128 128 { 129 129 this->bReloading_ = true; -
code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.h
r11164 r11174 52 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 53 53 54 void fire(unsigned int mode);54 void push(unsigned int mode); 55 55 void release(unsigned int mode); 56 56 void reload(); -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.cc
r11170 r11174 168 168 } 169 169 170 bool WeaponMode::push(float* reloadTime) 171 { 172 if( this->chargeable_) 173 { 174 // setting up a timer for knowing how long the weapon was charged 175 // and passes the value to this->cTime_ 176 } else { 177 return fire(reloadTime); 178 } 179 180 } 181 170 182 bool WeaponMode::release(float* reloadTime) 171 183 { 172 this->release(); 173 return false; 184 if( this->chargeable_) 185 { 186 return fire(reloadTime); 187 } 174 188 } 175 189 -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.h
r11170 r11174 57 57 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 58 58 59 virtual bool push(float* reloadTime); 60 virtual bool release(float* reloadTime); 59 61 virtual bool fire(float* reloadTime); 60 virtual bool release(float* reloadTime);61 62 bool reload(); 62 63 … … 165 166 166 167 virtual void fire() = 0; 167 virtual void release() {};168 168 169 169 unsigned int initialMunition_; -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.cc
r11170 r11174 74 74 Fire all weapons in this WeaponSet with the defined weaponmode. 75 75 */ 76 void WeaponPack:: fire(unsigned int weaponmode)76 void WeaponPack::push(unsigned int weaponmode) 77 77 { 78 78 for (Weapon* weapon : this->weapons_) 79 weapon-> fire(weaponmode);79 weapon->push(weaponmode); 80 80 } 81 81 -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.h
r11164 r11174 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 void fire(unsigned int weaponmode);48 void push(unsigned int weaponmode); 49 49 void release(unsigned int weaponmode); 50 50 void reload(); -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.cc
r11170 r11174 60 60 } 61 61 62 void WeaponSet:: fire()62 void WeaponSet::push() 63 63 { 64 64 // Fire all WeaponPacks with their defined weaponmode 65 65 for (const auto& mapEntry : this->weaponpacks_) 66 66 if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED) 67 mapEntry.first-> fire(mapEntry.second);67 mapEntry.first->push(mapEntry.second); 68 68 } 69 69 -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.h
r11164 r11174 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 void fire();48 void push(); 49 49 void release(); 50 50 void reload(); -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.cc
r11170 r11174 287 287 Fires the @ref orxonox::WeaponSet with the specified firemode. 288 288 */ 289 void WeaponSystem:: fire(unsigned int firemode)289 void WeaponSystem::push(unsigned int firemode) 290 290 { 291 291 std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode); 292 292 if (it != this->weaponSets_.end() && it->second) 293 it->second-> fire();293 it->second->push(); 294 294 } 295 295 -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.h
r11164 r11174 74 74 void changeWeaponmode(WeaponPack * wPack, WeaponSet * wSet, unsigned int weaponmode); 75 75 76 void fire(unsigned int firemode);76 void push(unsigned int firemode); 77 77 void release(unsigned int firemode); 78 78 void reload(); -
code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.cc
r11170 r11174 299 299 } 300 300 301 void ControllableEntity:: fire(unsigned int firemode)301 void ControllableEntity::push(unsigned int firemode) 302 302 { 303 303 if(GameMode::isMaster()) 304 304 { 305 this-> fired(firemode);305 this->pushed(firemode); 306 306 } 307 307 else -
code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.h
r11164 r11174 96 96 { this->rotateRoll(Vector2(value, 0)); } 97 97 98 void fire(unsigned int firemode);98 void push(unsigned int firemode); 99 99 void release(unsigned int firemode); 100 virtual void fired(unsigned int firemode) {}100 virtual void pushed(unsigned int firemode) {} 101 101 virtual void released(unsigned int firemode) {} 102 102 virtual void reload() {} -
code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.cc
r11170 r11174 428 428 */ 429 429 430 void Pawn:: fired(unsigned int firemode)431 { 432 if (this->weaponSystem_) 433 this->weaponSystem_-> fire(firemode);430 void Pawn::pushed(unsigned int firemode) 431 { 432 if (this->weaponSystem_) 433 this->weaponSystem_->push(firemode); 434 434 } 435 435 -
code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.h
r11166 r11174 157 157 virtual void kill(); 158 158 159 virtual void fired(unsigned int firemode) override;159 virtual void pushed(unsigned int firemode) override; 160 160 virtual void released(unsigned int firemode) override; 161 161 virtual void postSpawn();
Note: See TracChangeset
for help on using the changeset viewer.