Changeset 2398 for code/branches/weapon2/src/orxonox
- Timestamp:
- Dec 10, 2008, 9:20:39 PM (16 years ago)
- Location:
- code/branches/weapon2/src/orxonox
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapon2/src/orxonox/CMakeLists.txt
r2288 r2398 92 92 objects/weaponSystem/Munition.cc 93 93 objects/weaponSystem/weapons/LaserGun.cc 94 objects/weaponSystem/weapons/Fusion.cc 94 95 objects/weaponSystem/munitions/LaserGunMunition.cc 95 96 objects/weaponSystem/projectiles/BillboardProjectile.cc -
code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.cc
r2393 r2398 45 45 this->magazineReadyToShoot_ = true; 46 46 this->parentWeaponSystem_ = 0; 47 this-> parentWeaponSlot_ = 0;47 this->attachedToWeaponSlot_ = 0; 48 48 this->munition_ = 0; 49 49 this->bulletLoadingTime_ = 0; … … 61 61 SUPER(Weapon, XMLPort, xmlelement, mode); 62 62 XMLPortParam(Weapon, "munitionType", setMunitionType, getMunitionType, xmlelement, mode); 63 XMLPortParam(Weapon, "bulletLoadingTime", setBulletLoadingTime, getBulletLoadingTime, xmlelement, mode); 64 XMLPortParam(Weapon, "magazineLoadingTime", setMagazineLoadingTime, getMagazineLoadingTime, xmlelement, mode); 63 65 } 64 66 65 67 void Weapon::setWeapon() 66 68 { 67 COUT(0) << "LaserGun::setWeapon" << std::endl;68 this->bulletLoadingTime_ = 0.5;69 this->magazineLoadingTime_ = 3.0;70 this->munition_->setMaxMagazines(100);71 this->munition_->setMaxBullets(6);72 69 this->munition_->fillBullets(); 73 70 this->munition_->fillMagazines(); … … 165 162 166 163 void Weapon::setMunitionType(std::string munitionType) 167 { 168 COUT(0) << "Weapon::setMunitionType (XMLPort) "<< munitionType << std::endl; 169 this->munitionType_ = munitionType; } 164 { this->munitionType_ = munitionType; } 170 165 171 166 const std::string Weapon::getMunitionType() 172 167 { return this->munitionType_; } 168 169 void Weapon::setBulletLoadingTime(float loadingTime) 170 { this->bulletLoadingTime_ = loadingTime; } 171 172 const float Weapon::getBulletLoadingTime() 173 { return this->bulletLoadingTime_; } 174 175 void Weapon::setMagazineLoadingTime(float loadingTime) 176 { this->magazineLoadingTime_ = loadingTime; } 177 178 const float Weapon::getMagazineLoadingTime() 179 { return this->magazineLoadingTime_; } 180 173 181 174 182 Munition * Weapon::getAttachedMunition(std::string munitionType) … … 179 187 return this->munition_; } 180 188 181 182 183 void Weapon::setBulletLoadingTime(float loadingTime)184 { this->bulletLoadingTime_ = loadingTime; }185 186 float Weapon::getBulletLoadingTime()187 { return this->bulletLoadingTime_; }188 189 void Weapon::setMagazineLoadingTime(float loadingTime)190 { this->magazineLoadingTime_ = loadingTime; }191 192 float Weapon::getMagazineLoadingTime()193 { return this->magazineLoadingTime_; }194 195 196 Timer<Weapon> * Weapon::getBulletTimer()197 { return &this->bulletReloadTimer_; }198 199 Timer<Weapon> * Weapon::getMagazineTimer()200 { return &this->magazineReloadTimer_; }201 202 189 void Weapon::takeBullets() { }; 203 190 void Weapon::createProjectile() { }; -
code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.h
r2391 r2398 61 61 void bulletReloaded(); 62 62 void magazineReloaded(); 63 void setBulletLoadingTime(float loadingTime);64 float getBulletLoadingTime();65 void setMagazineLoadingTime(float loadingTime);66 float getMagazineLoadingTime();67 Timer<Weapon> *getBulletTimer();68 Timer<Weapon> *getMagazineTimer();69 63 70 64 virtual void setMunitionType(std::string munitionType); 71 65 virtual const std::string getMunitionType(); 66 virtual void setBulletLoadingTime(float loadingTime); 67 virtual const float getBulletLoadingTime(); 68 virtual void setMagazineLoadingTime(float loadingTime); 69 virtual const float getMagazineLoadingTime(); 72 70 73 71 virtual void takeBullets(); … … 75 73 virtual void createProjectile(); 76 74 77 inline void setParentWeaponSlot(WeaponSlot *parentWeaponSlot)78 { this->parentWeaponSlot_=parentWeaponSlot; };79 inline WeaponSlot * getParentWeaponSlot()80 { return this->parentWeaponSlot_; };81 75 inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem) 82 76 { this->parentWeaponSystem_=parentWeaponSystem; }; … … 84 78 { return this->parentWeaponSystem_; }; 85 79 86 //in future by XMLPort 80 inline void setAttachedToWeaponSlot(WeaponSlot * wSlot) 81 { this->attachedToWeaponSlot_ = wSlot; } 82 inline WeaponSlot * getAttachedToWeaponSlot() 83 { return this->attachedToWeaponSlot_; } 84 87 85 virtual void setWeapon(); 88 86 … … 90 88 91 89 protected: 90 bool bReloading_; 92 91 bool bulletReadyToShoot_; 93 92 bool magazineReadyToShoot_; 94 93 float bulletLoadingTime_; 95 94 float magazineLoadingTime_; 96 bool bReloading_;97 98 Munition *munition_;99 95 std::string munitionType_; 100 96 101 WeaponSlot *parentWeaponSlot_; 102 WeaponSystem *parentWeaponSystem_; 97 WeaponSlot * attachedToWeaponSlot_; 98 Munition * munition_; 99 WeaponSystem * parentWeaponSystem_; 100 103 101 SubclassIdentifier<Munition> munitionIdentifier_; 102 104 103 Timer<Weapon> bulletReloadTimer_; 105 104 Timer<Weapon> magazineReloadTimer_; -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponPack.cc
r2391 r2398 64 64 { 65 65 COUT(0) << "WeaponPack::fire (attached from WeaponSet) from Weapon: "<< i << std::endl; 66 this->weapons_[i]-> fire();66 this->weapons_[i]->getAttachedToWeaponSlot()->fire(); 67 67 } 68 68 } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSet.cc
r2391 r2398 68 68 { 69 69 //at the moment this function only works for one weaponPack in the entire WeaponSystem... 70 if ( this->parentWeaponSystem_->getWeaponSlotPointer(i)->getAttachedWeapon() == 0 ) //if slot not full70 if ( this->parentWeaponSystem_->getWeaponSlotPointer(i)->getAttachedWeapon() == 0 && this->parentWeaponSystem_->getWeaponSlotPointer(i) != 0) //if slot not full 71 71 { 72 COUT(0) << "WeaponSet::attachWeaponPack attaching Weapon" << std::endl; 72 73 this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(i) ); 73 74 this->parentWeaponSystem_->getWeaponSlotPointer(i)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) ); 74 75 wPackWeapon++; 76 } 77 else 78 { 79 for (int k=0; k < this->parentWeaponSystem_->getWeaponSlotSize(); k++) 80 { 81 if ( this->parentWeaponSystem_->getWeaponSlotPointer(k)->getAttachedWeapon() == 0 ) 82 { 83 COUT(0) << "WeaponSet::attachWeaponPack mode 2 k="<< k << std::endl; 84 this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(k) ); 85 this->parentWeaponSystem_->getWeaponSlotPointer(k)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) ); 86 wPackWeapon++; 87 } 88 } 75 89 } 76 90 } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSlot.cc
r2391 r2398 66 66 void WeaponSlot::fire() 67 67 { 68 if ( this->attachedWeapon_ ) 68 69 COUT(0) << "WeaponSlot::fire" << std::endl; 69 70 this->attachedWeapon_->fire(); … … 79 80 { 80 81 this->attachedWeapon_ = weapon; 82 weapon->setAttachedToWeaponSlot(this); 81 83 this->attach(weapon); 82 84 COUT(0) << "WeaponSlot::attachWeapon position=" << this->getWorldPosition() << std::endl; -
code/branches/weapon2/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.cc
r2337 r2398 42 42 { 43 43 RegisterObject(LaserGunMunition); 44 45 this->maxBullets_ = 40; 46 this->maxMagazines_ = 100; 44 47 } 45 48 -
code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.cc
r2391 r2398 43 43 RegisterObject(ParticleProjectile); 44 44 45 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot 2_small", LODParticle::normal);45 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::normal); 46 46 this->particles_->addToSceneNode(this->getNode()); 47 //this->particles_->setKeepParticlesInLocalSpace(true);47 this->particles_->setKeepParticlesInLocalSpace(0); 48 48 49 49 this->particles_->getAllEmitters()->setDirection(-WorldEntity::FRONT); -
code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc
r2391 r2398 44 44 { 45 45 RegisterObject(LaserGun); 46 47 //in future XMLPort 48 this->speed_ = 250; 46 47 this->speed_ = 1250; 49 48 50 49 } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.h
r2379 r2398 47 47 LaserGun(BaseObject* creator); 48 48 virtual ~LaserGun(); 49 49 50 50 virtual void takeBullets(); 51 51 virtual void takeMagazines(); -
code/branches/weapon2/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2391 r2398 137 137 void Pawn::fire(WeaponMode::Enum fireMode) 138 138 { 139 COUT(0) << "Pawn::fire" << std::endl;139 COUT(0) << "Pawn::fire" << fireMode << std::endl; 140 140 if (this->weaponSystem_) 141 141 this->weaponSystem_->fire(fireMode); … … 152 152 void Pawn::setWeaponSlot(WeaponSlot * wSlot) 153 153 { 154 COUT(0) << "Pawn::setWeaponSlot" << std::endl;154 COUT(0) << "Pawn::setWeaponSlot" << wSlot << std::endl; 155 155 this->attach(wSlot); 156 156 this->weaponSystem_->attachWeaponSlot(wSlot); }
Note: See TracChangeset
for help on using the changeset viewer.