Changeset 2186
- Timestamp:
- Nov 12, 2008, 12:50:18 PM (16 years ago)
- Location:
- code/branches/weapon2/src/orxonox
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapon2/src/orxonox/CMakeLists.txt
r2106 r2186 90 90 objects/weaponSystem/Weapon.cc 91 91 objects/weaponSystem/Munition.cc 92 objects/weaponSystem/weapons/LaserGun.cc 93 objects/weaponSystem/munitions/LaserGunMunition.cc 94 objects/weaponSystem/projectiles/BillboardProjectile.cc 95 objects/weaponSystem/projectiles/ParticleProjectile.cc 96 objects/weaponSystem/projectiles/Projectile.cc 92 97 93 98 objects/worldentities/triggers/Trigger.cc -
code/branches/weapon2/src/orxonox/OrxonoxPrereqs.h
r2096 r2186 133 133 class Weapon; 134 134 class Munition; 135 class LaserGun; 136 class LaserGunMunition; 135 137 136 138 class EventListener; -
code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.cc
r2145 r2186 42 42 RegisterObject(Weapon); 43 43 this->weaponReadyToShoot_ = true; 44 //this->setParentWeaponSystem(); 44 this->setParentWeaponSystem(); 45 this->pointerToMunition_ = this->parentWeaponSystem_->getAttachedMunitionPointer; 46 this->attachNeededMunition(this->pointerToMunition_); 45 47 46 48 } … … 66 68 } 67 69 68 void Weapon::attachNeededMunition(Munition *PointerToMunition)70 void attachNeededMunition(Munition *pointerToMunition) 69 71 { 72 //if munition type already exist attach it, else create a new one of this type and attach it to the weapon and to the WeaponSystem 73 if ( this->parentWeaponSystem_->munitionSet_[laserGunMunition] ) 74 this->pointerToMunition_ = pointerToMunition; 75 else 76 { 77 this->pointerToMunition_ = new LaserGunMunition; 78 this->parentWeaponSystem_->munitionSet_[laserGunMunition] = this->pointerToMunition_; 70 79 80 } 71 81 } 82 72 83 /* 73 84 void Weapon::setParentWeaponSystem() -
code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.h
r2145 r2186 48 48 virtual void fire(); 49 49 void reloaded(); 50 virtual void attachNeededMunition(Munition *PointerToMunition); 50 virtual void setParentWeaponSystem(); 51 void attachNeededMunition(Munition *munitionPointer); 51 52 52 53 inline void setParentWeaponSlot(WeaponSlot *parentWeaponSlot) … … 55 56 { return parentWeaponSlot_; }; 56 57 57 //void setParentWeaponSystem(); 58 59 58 60 59 61 private: … … 62 64 Munition *pointerToMunition_; 63 65 WeaponSlot *parentWeaponSlot_; 64 //WeaponSystem *parentWeaponSystem_;66 WeaponSystem *parentWeaponSystem_; 65 67 Timer<Weapon> reloadTimer_; 66 68 -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSlot.h
r2145 r2186 63 63 64 64 WeaponSet *parentWeaponSet_; 65 66 //attached weapon orientation 67 int yaw_ = 0; 68 int pitch_ = 0; 69 int roll_ = 0; 65 70 }; 66 71 } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSystem.cc
r2145 r2186 52 52 this->activeWeaponSet_ = 0; 53 53 this->parentSpaceShip_ = 0; 54 //this->attachedMunition_ =0;54 this->attachedMunition_ =0; 55 55 } 56 56 … … 80 80 void WeaponSystem::fire(WeaponMode::Enum n) 81 81 { 82 if (n < this->weaponSets_.size())82 if (n < (int)this->weaponSets_.size()) 83 83 this->weaponSets_[n]->fire(); 84 84 } … … 98 98 } 99 99 100 /* 100 Munition * WeaponSystem::getAttachedMunitionPointer() 101 { 102 return this->attachedMunition_; 103 } 104 101 105 void WeaponSystem::addMunitionType(Munition *munitionPointer) 102 106 { … … 106 110 this->attachedMunition_ = munitionPointer; 107 111 else 108 this->unlimitedAmmo_ = true;112 ;//was? 109 113 110 114 } 111 */ 115 112 116 113 117 } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSystem.h
r2145 r2186 43 43 { 44 44 enum Enum 45 { LaserGunMunition };45 { laserGunMunition }; 46 46 } 47 47 … … 68 68 //void setActiveWeaponSet(unsigned int n); 69 69 WeaponSet * getWeaponSetPointer(unsigned int n); 70 Munition * getAttachedMunitionPointer(); 70 71 71 72 inline void setParentSpaceShip(SpaceShip *parentSpaceShip) … … 80 81 WeaponSet *activeWeaponSet_; 81 82 SpaceShip *parentSpaceShip_; 83 Munition * attachedMunition_; 82 84 }; 83 85 } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.cc
r2097 r2186 37 37 namespace orxonox 38 38 { 39 LaserGunMunition::LaserGunMunition(BaseObject* creator) : BaseObject(creator)39 LaserGunMunition::LaserGunMunition(BaseObject* creator) : Munition(creator) 40 40 { 41 41 RegisterObject(LaserGunMunition); -
code/branches/weapon2/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.h
r2145 r2186 33 33 34 34 #include "core/BaseObject.h" 35 35 #include "../Munition.h" 36 36 37 37 namespace orxonox -
code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc
r2145 r2186 34 34 #include "util/Debug.h" 35 35 36 #include "LaserGun.h" 37 36 38 37 39 namespace orxonox … … 41 43 RegisterObject(LaserGun); 42 44 43 this->attachNeededMunition();44 45 45 //set weapon properties here 46 this->projectileColor_ = ColourValue(1.0, 1.0, 0.5)47 46 this->loadingTime_ = 0.5; 48 47 } … … 76 75 } 77 76 78 ColorValue LaserGun::getProjectileColor()79 {80 return projectileColor_;81 }82 83 void attachNeededMunition(Munition *pointerToMunition)84 {85 //if munition type already exist attach it, else create a new one of this type and attach it to the weapon and to the WeaponSystem86 if ( this->parentWeaponSystem_->munitionSet_[laserGunMunition] )87 this->pointerToMunition_ = pointerToMunition;88 else89 {90 this->pointerToMunition_ = new LaserGunMunition;91 92 }93 }94 77 } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.h
r2145 r2186 34 34 #include "core/BaseObject.h" 35 35 36 #include " LaserGunMunition.h"36 #include "../munitions/LaserGunMunition.h" 37 37 #include "util/Math.h" 38 #include "../Weapon.h" 38 39 39 40 namespace orxonox … … 48 49 49 50 void fire(); 50 ColourValue LaserGun::getProjectileColour(); 51 51 52 52 53 private: 53 ColorValue projectileColor_; 54 54 55 55 56 };
Note: See TracChangeset
for help on using the changeset viewer.