Changeset 2308 for code/branches/weapon2/src/orxonox/objects/weaponSystem
- Timestamp:
- Dec 2, 2008, 7:51:46 PM (16 years ago)
- Location:
- code/branches/weapon2/src/orxonox/objects/weaponSystem
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSet.cc
r2288 r2308 55 55 if (this->parentWeaponSystem_->getWeaponSlotSize()>0 && wPack->getSize()>0 && ( wPack->getSize() <= this->parentWeaponSystem_->getWeaponSlotSize() ) ) 56 56 { 57 this->attachedWeaponPack_ = wPack; 57 58 //should be possible to choose which slot to use 58 59 for ( int i=0; i < wPack->getSize() ; i++ ) 59 60 { 61 //at the moment this function only works for one weaponPack in the entire WeaponSystem... 62 this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(i) ); 60 63 this->parentWeaponSystem_->getWeaponSlotPointer(i)->attachWeapon( wPack->getWeaponPointer(i) ); 61 64 } … … 63 66 } 64 67 65 /* this function will be in WeaponPack 68 66 69 void WeaponSet::fire() 67 70 { 68 for (int i=0; i < (int) this->weaponSlots_.size(); i++) 69 { 70 COUT(0) << "WeaponSlot::fire"<< i << std::endl; 71 this->weaponSlots_[i]->fire(); 72 } 71 //fires all WeaponSlots available for this weaponSet attached from the WeaponPack 72 this->attachedWeaponPack_->fire(); 73 73 } 74 */ 74 75 void WeaponSet::setFireMode(const unsigned int firemode) 76 { this->firemode_ = firemode; } 77 78 const unsigned int WeaponSet::getFireMode() const 79 { return this->firemode_; } 75 80 76 81 void WeaponSet::XMLPort(Element& xmlelement, XMLPort::Mode mode) 77 82 { 78 83 SUPER(WeaponSet, XMLPort, xmlelement, mode); 84 XMLPortParam(WeaponSet, "firemode", setFireMode, getFireMode, xmlelement, mode); 79 85 } 80 86 -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSet.h
r2288 r2308 51 51 void fire(); 52 52 53 void setFireMode(const unsigned int firemode); 54 const unsigned int getFireMode() const; 55 53 56 inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem) 54 57 { parentWeaponSystem_=parentWeaponSystem; } … … 58 61 private: 59 62 WeaponSystem *parentWeaponSystem_; 63 std::vector<WeaponSlot *> setWeaponSlots_; 64 unsigned int firemode_; 65 WeaponPack * attachedWeaponPack_; 60 66 }; 61 67 } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSlot.cc
r2288 r2308 72 72 void WeaponSlot::XMLPort(Element& xmlelement, XMLPort::Mode mode) 73 73 { 74 SUPER(WeaponSlot, XMLPort, xmlelement, mode); 75 XMLPortObject(WeaponSlot, Weapon, "attached-weapon", attachWeapon, getAttachedWeapon, xmlelement, mode); 74 76 75 } 77 76 -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSystem.cc
r2288 r2308 105 105 if (n < (int)this->weaponSets_.size()) 106 106 COUT(0) << "WeaponSystem::fire - after if" << std::endl; 107 //this->weaponSets_[n]->fire();107 this->weaponSets_[n]->fire(); 108 108 } 109 109
Note: See TracChangeset
for help on using the changeset viewer.