Changeset 2337 for code/branches/weapon2/src/orxonox
- Timestamp:
- Dec 3, 2008, 6:26:53 PM (16 years ago)
- Location:
- code/branches/weapon2/src/orxonox/objects
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapon2/src/orxonox/objects/weaponSystem/Munition.h
r2232 r2337 59 59 60 60 private: 61 62 protected: 61 63 unsigned int bullets_; 62 64 unsigned int magazines_; -
code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.cc
r2331 r2337 44 44 this->bulletReadyToShoot_ = true; 45 45 this->magazineReadyToShoot_ = true; 46 this->parentWeaponSystem_ = 0; 47 this->parentWeaponSlot_ = 0; 48 this->munition_ = 0; 46 49 } 47 50 … … 90 93 { 91 94 //create new munition with identifier 95 COUT(0) << "Weapon::attachNeededMunition, create new Munition of Type " << munitionName << std::endl; 92 96 this->munitionIdentifier_ = ClassByString(munitionName); 93 97 this->munition_ = this->munitionIdentifier_.fabricate(this); … … 108 112 { return this->munitionType_; } 109 113 110 Munition * Weapon::getAttachedMunition() 111 { return this->munition_; } 114 Munition * Weapon::getAttachedMunition(std::string munitionType) 115 { 116 COUT(0) << "Weapon::getAttachedMunition, parentWeaponSystem_="<< this->parentWeaponSystem_ << std::endl; 117 this->parentWeaponSystem_->getMunitionType(munitionType); 118 COUT(0) << "Weapon::getAttachedMunition, munition_="<< this->munition_ << std::endl; 119 return this->munition_; } 112 120 113 121 void Weapon::setBulletLoadingTime(float loadingTime) -
code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.h
r2331 r2337 52 52 virtual void fire(); 53 53 void attachNeededMunition(std::string munitionType); 54 Munition * getAttachedMunition( );54 Munition * getAttachedMunition(std::string munitiontype); 55 55 56 56 //reloading … … 83 83 84 84 private: 85 86 protected: 85 87 bool bulletReadyToShoot_; 86 88 bool magazineReadyToShoot_; -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponPack.cc
r2331 r2337 104 104 return weapons_[index]; 105 105 } 106 107 void WeaponPack::setWeaponSystemToAllWeapons(WeaponSystem * weaponSystem) 108 { 109 for (int i=0; i < (int) this->weapons_.size(); i++) 110 { 111 this->weapons_[i]->setParentWeaponSystem(weaponSystem); 112 } 113 114 } 106 115 } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponPack.h
r2319 r2337 60 60 Weapon * getWeapon(unsigned int index); 61 61 62 void setWeaponSystemToAllWeapons(WeaponSystem * weaponSystem); 63 62 64 inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem) 63 65 { parentWeaponSystem_=parentWeaponSystem; } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSet.cc
r2327 r2337 46 46 47 47 this->parentWeaponSystem_ = 0; 48 48 this->attachedWeaponPack_ = 0; 49 49 } 50 50 -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSystem.cc
r2331 r2337 84 84 this->munitionSet_[munitionType] = munitionToAdd; 85 85 } 86 87 //returns the Pointer to the munitionType 86 88 Munition * WeaponSystem::getMunitionType(std::string munitionType) 87 89 { -
code/branches/weapon2/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.cc
r2186 r2337 37 37 namespace orxonox 38 38 { 39 CreateFactory(LaserGunMunition); 40 39 41 LaserGunMunition::LaserGunMunition(BaseObject* creator) : Munition(creator) 40 42 { -
code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc
r2331 r2337 61 61 if ( this->getBulletReadyToShoot() && this->getMagazineReadyToShoot() ) 62 62 { 63 COUT(0) << "LaserGun::fire - ready to shoot" << std::endl; 63 64 //take munition 64 this->getAttachedMunition( )->removeBullets(1,this);65 this->getAttachedMunition(this->munitionType_)->removeBullets(1,this); 65 66 Weapon::bulletTimer(); 66 67 this->setBulletReadyToShoot(false); -
code/branches/weapon2/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2327 r2337 167 167 { 168 168 COUT(0) << "Pawn::setWeaponPack" << std::endl; 169 this->weaponSystem_->attachWeaponPack( wPack,wPack->getFireMode() ); } 169 this->weaponSystem_->attachWeaponPack( wPack,wPack->getFireMode() ); 170 wPack->setParentWeaponSystem(this->weaponSystem_); 171 wPack->setWeaponSystemToAllWeapons(this->weaponSystem_); 172 } 173 170 174 WeaponPack * Pawn::getWeaponPack(unsigned int firemode) const 171 175 { return this->weaponSystem_->getWeaponPackPointer(firemode); }
Note: See TracChangeset
for help on using the changeset viewer.