Changeset 2098
- Timestamp:
- Nov 1, 2008, 11:17:22 PM (16 years ago)
- Location:
- code/trunk/src/orxonox/objects
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/objects/WeaponSystem.cc
r2097 r2098 48 48 { 49 49 RegisterObject(WeaponSystem); 50 51 this->activeWeaponSet_ = 0; 52 this->parentSpaceShip_ = 0; 50 53 } 51 54 … … 62 65 63 66 //the first weaponSet is at n=0 64 void WeaponSystem::setActiveWeaponSet( int n)67 void WeaponSystem::setActiveWeaponSet(unsigned int n) 65 68 { 66 if ( (int) weaponSets_.size() <= n ) 67 n=0; 68 this->activeWeaponSet_ = this->weaponSets_[n]; 69 if (n < this->weaponSets_.size()) 70 this->activeWeaponSet_ = this->weaponSets_[n]; 69 71 } 70 72 71 73 //n is the n'th weaponSet, starting with zero 72 74 //Spaceship.cc only needs to have the keybinding to a specific Set-number n 73 void WeaponSystem::fire( int n)75 void WeaponSystem::fire(unsigned int n) 74 76 { 75 if (n >=0)77 if (n < this->weaponSets_.size()) 76 78 this->weaponSets_[n]->fire(); 77 79 } 78 80 79 WeaponSet * WeaponSystem::getWeaponSetPointer(int n)81 void WeaponSystem::fire() 80 82 { 81 return this->weaponSets_[n]; 83 if (this->activeWeaponSet_) 84 this->activeWeaponSet_->fire(); 85 } 86 87 WeaponSet * WeaponSystem::getWeaponSetPointer(unsigned int n) 88 { 89 if (n < this->weaponSets_.size()) 90 return this->weaponSets_[n]; 91 else 92 return 0; 82 93 } 83 94 -
code/trunk/src/orxonox/objects/WeaponSystem.h
r2097 r2098 48 48 49 49 void attachWeaponSet(WeaponSet *wSet); 50 void fire(int n); 51 void setActiveWeaponSet(int n); 52 WeaponSet * getWeaponSetPointer(int n); 50 void fire(); 51 void fire(unsigned int n); 52 void setActiveWeaponSet(unsigned int n); 53 WeaponSet * getWeaponSetPointer(unsigned int n); 53 54 54 55 inline void WeaponSystem::setParentSpaceShip(SpaceShip *parentSpaceShip) -
code/trunk/src/orxonox/objects/weaponSystem/Weapon.cc
r2097 r2098 40 40 { 41 41 RegisterObject(Weapon); 42 43 this->loadingTime_ = 0; 44 this->munition_ = 0; 45 42 46 } 43 47 -
code/trunk/src/orxonox/objects/weaponSystem/Weapon.h
r2097 r2098 49 49 50 50 private: 51 int loadingTime ;51 int loadingTime_; 52 52 Munition *munition_; 53 53 -
code/trunk/src/orxonox/objects/weaponSystem/WeaponSet.cc
r2097 r2098 42 42 RegisterObject(WeaponSet); 43 43 44 this->parentWeaponSystem_ = 0; 45 44 46 for (int i=0;i<k;i++) 45 47 { … … 68 70 } 69 71 70 WeaponSlot * WeaponSet::getWeaponSlotPointer( int n)72 WeaponSlot * WeaponSet::getWeaponSlotPointer(unsigned int n) 71 73 { 72 return this->weaponSlots_[n]; 74 if (n < this->weaponSlots_.size()) 75 return this->weaponSlots_[n]; 76 else 77 return 0; 73 78 } 74 79 -
code/trunk/src/orxonox/objects/weaponSystem/WeaponSet.h
r2097 r2098 50 50 void WeaponSet::attachWeaponSlot(WeaponSlot *wSlot); 51 51 void WeaponSet::fire(); 52 WeaponSlot * getWeaponSlotPointer( int n);52 WeaponSlot * getWeaponSlotPointer(unsigned int n); 53 53 54 54 inline void WeaponSet::setParentWeaponSystem(WeaponSystem *parentWeaponSystem) -
code/trunk/src/orxonox/objects/weaponSystem/WeaponSlot.cc
r2097 r2098 42 42 { 43 43 RegisterObject(WeaponSlot); 44 45 this->unlimitedAmmo_ = false; 46 47 this->attachedWeapon_ = 0; 48 this->parentWeaponSet_ = 0; 44 49 } 45 50 -
code/trunk/src/orxonox/objects/weaponSystem/weapons/LaserGun.h
r2097 r2098 35 35 36 36 #include "LaserGunMunition.h" 37 #include "../tools/BillboardSet.h" 37 #include "tools/BillboardSet.h" 38 #include "util/Math.h" 38 39 39 40 namespace orxonox -
code/trunk/src/orxonox/objects/weaponSystem/weapons/Missile.h
r2097 r2098 32 32 #include "OrxonoxPrereqs.h" 33 33 34 #include " core/BaseObject.h"34 #include "objects/weaponSystem/Weapon.h" 35 35 36 36 37 37 namespace orxonox 38 38 { 39 class _OrxonoxExport Missile : public BaseObject : publicWeapon39 class _OrxonoxExport Missile : public Weapon 40 40 { 41 41 public: -
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2087 r2098 35 35 #include "objects/infos/PlayerInfo.h" 36 36 #include "objects/gametypes/Gametype.h" 37 #include "objects/WeaponSystem.h" 37 38 38 39 namespace orxonox … … 51 52 52 53 this->lastHitOriginator_ = 0; 54 this->weaponSystem_ = 0; 55 56 /* 57 //WeaponSystem 58 weaponSystem_ = new WeaponSystem(); 59 WeaponSet * weaponSet1 = new WeaponSet(1); 60 this->weaponSystem_->attachWeaponSet(weaponSet1); 61 this->weaponSystem_->getWeaponSetPointer(0)->getWeaponSlotPointer(0)->setAmmoType(true); 62 */ 53 63 54 64 this->registerVariables(); … … 127 137 } 128 138 139 void Pawn::fire() 140 { 141 if (this->weaponSystem_) 142 this->weaponSystem_->fire(); 143 } 144 129 145 void Pawn::postSpawn() 130 146 { -
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h
r2087 r2098 74 74 virtual void kill(); 75 75 76 virtual void fire(); 77 76 78 virtual void postSpawn(); 77 79 … … 87 89 88 90 Pawn* lastHitOriginator_; 91 92 WeaponSystem* weaponSystem_; 89 93 }; 90 94 }
Note: See TracChangeset
for help on using the changeset viewer.