Changeset 2308 for code/branches/weapon2
- Timestamp:
- Dec 2, 2008, 7:51:46 PM (16 years ago)
- Location:
- code/branches/weapon2/src/orxonox/objects
- Files:
-
- 6 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 -
code/branches/weapon2/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2288 r2308 77 77 78 78 XMLPortObject(Pawn, WeaponSlot, "weaponslots", setWeaponSlot, getWeaponSlot, xmlelement, mode); 79 XMLPortObject(Pawn, WeaponSet, "weaponsets", setWeaponSet, getWeaponSet, xmlelement, mode); 79 80 //XMLPortObject(Pawn, WeaponPack, "weapons", setWeaponPack, getWeaponPack, xmlelement, mode); 80 81 … … 153 154 } 154 155 156 155 157 void Pawn::setWeaponSlot(WeaponSlot * wSlot) 156 { 157 this->weaponSystem_->attachWeaponSlot(wSlot);158 }158 { this->weaponSystem_->attachWeaponSlot(wSlot); } 159 WeaponSlot * Pawn::getWeaponSlot(unsigned int index) const 160 { return this->weaponSystem_->getWeaponSlotPointer(index); } 159 161 160 WeaponSlot * Pawn::getWeaponSlot(unsigned int index) const 161 { 162 return this->weaponSystem_->getWeaponSlotPointer(index); 163 } 162 /* 163 void Pawn::setWeaponPack(WeaponPack * wPack) 164 { this->weaponSystem_->attachWeaponPack(wPack); } 165 WeaponPack * Pawn::getWeaponPack(unsigned int index) const 166 { return this->weaponSystem_->getWeaponPackPointer(index); 167 */ 168 169 void Pawn::setWeaponSet(WeaponSet * wSet) 170 { this->weaponSystem_->attachWeaponSet(wSet); } 171 WeaponSet * Pawn::getWeaponSet(unsigned int index) const 172 { return this->weaponSystem_->getWeaponSetPointer(index); } 164 173 165 174 } -
code/branches/weapon2/src/orxonox/objects/worldentities/pawns/Pawn.h
r2288 r2308 81 81 void setWeaponSlot(WeaponSlot * wSlot); 82 82 WeaponSlot * getWeaponSlot(unsigned int index) const; 83 // void setWeaponPack(WeaponPack * wPack); 84 // WeaponPack * getWeaponPack(unsigned int index) const; 85 void setWeaponSet(WeaponSet * wSet); 86 WeaponSet * getWeaponSet(unsigned int index) const; 83 87 84 88 protected:
Note: See TracChangeset
for help on using the changeset viewer.