- Timestamp:
- Oct 29, 2008, 4:13:10 PM (16 years ago)
- Location:
- code/branches/weapon/src/orxonox/objects
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapon/src/orxonox/objects/BillboardProjectile.cc
r1907 r2060 38 38 CreateFactory(BillboardProjectile); 39 39 40 BillboardProjectile::BillboardProjectile( SpaceShip* owner) : Projectile(owner)40 BillboardProjectile::BillboardProjectile(Weapon* owner) : Projectile(owner) 41 41 { 42 42 RegisterObject(BillboardProjectile); -
code/branches/weapon/src/orxonox/objects/BillboardProjectile.h
r1558 r2060 41 41 { 42 42 public: 43 BillboardProjectile( SpaceShip* owner = 0);43 BillboardProjectile(Weapon* owner = 0); 44 44 virtual ~BillboardProjectile(); 45 45 -
code/branches/weapon/src/orxonox/objects/ParticleProjectile.cc
r1907 r2060 38 38 CreateFactory(ParticleProjectile); 39 39 40 ParticleProjectile::ParticleProjectile( SpaceShip* owner) : BillboardProjectile(owner)40 ParticleProjectile::ParticleProjectile(Weapon* owner) : BillboardProjectile(owner) 41 41 { 42 42 RegisterObject(ParticleProjectile); … … 72 72 this->particles_->setEnabled(this->isVisible()); 73 73 } 74 74 75 75 bool ParticleProjectile::create(){ 76 76 if(!Projectile::create()) -
code/branches/weapon/src/orxonox/objects/ParticleProjectile.h
r1907 r2060 41 41 { 42 42 public: 43 ParticleProjectile( SpaceShip* owner = 0);43 ParticleProjectile(Weapon* owner = 0); 44 44 virtual ~ParticleProjectile(); 45 45 virtual void changedVisibility(); 46 46 void setConfigValues(); 47 47 48 48 virtual bool create(); 49 49 -
code/branches/weapon/src/orxonox/objects/Projectile.cc
r1907 r2060 47 47 float Projectile::speed_s = 5000; 48 48 49 Projectile::Projectile( SpaceShip* owner) : owner_(owner)49 Projectile::Projectile(Weapon* owner) : owner_(owner) 50 50 { 51 51 RegisterObject(Projectile); … … 57 57 this->setStatic(false); 58 58 this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL); 59 59 60 60 if (this->owner_) 61 61 { … … 124 124 delete this; 125 125 } 126 126 127 127 bool Projectile::create(){ 128 128 return WorldEntity::create(); -
code/branches/weapon/src/orxonox/objects/Projectile.h
r1907 r2060 45 45 void destroyObject(); 46 46 virtual void tick(float dt); 47 47 48 48 virtual bool create(); 49 49 … … 52 52 53 53 protected: 54 Projectile( SpaceShip* owner = 0);54 Projectile(Weapon* owner = 0); 55 55 SpaceShip* owner_; 56 56 -
code/branches/weapon/src/orxonox/objects/SpaceShip.cc
r2049 r2060 142 142 143 143 this->radarObject_ = static_cast<WorldEntity*>(this); 144 145 //WeaponSystem 146 weaponSystem_ = new WeaponSystem(); 147 WeaponSet * weaponSet1 = new WeaponSet(1); 148 this->weaponSystem_->attachWeaponSet(weaponSet1); 149 this->weaponSystem_->getWeaponSetPointer(0)->getWeaponSlotPointer(0)->setAmmoType(true); 150 144 151 } 145 152 … … 474 481 if (this->bLMousePressed_ && this->timeToReload_ <= 0) 475 482 { 476 477 BillboardProjectile* projectile = new ParticleProjectile(this); 478 projectile->setColour(this->getProjectileColour()); 479 projectile->create(); 480 if (projectile->getClassID() == 0) 481 { 482 COUT(3) << "generated projectile with classid 0" << std::endl; // TODO: remove this output 483 } 484 485 projectile->setObjectMode(0x3); 483 this->weaponSystem_->fire(0); 486 484 this->timeToReload_ = this->reloadTime_; 487 485 } -
code/branches/weapon/src/orxonox/objects/SpaceShip.h
r1625 r2060 38 38 #include "RadarViewable.h" 39 39 #include "tools/BillboardSet.h" 40 41 #include "WeaponSystem.h" 40 42 41 43 namespace orxonox … … 181 183 float mouseY_; 182 184 185 //WeaponSystem 186 WeaponSystem * weaponSystem_; 187 183 188 protected: 184 189 bool myShip_; -
code/branches/weapon/src/orxonox/objects/WeaponSystem.cc
r2049 r2060 77 77 } 78 78 79 WeaponSet * getWeaponSetPointer(int n) 80 { 81 return this->weaponSets_[n]; 82 } 83 79 84 void WeaponSystem::XMLPort(Element& xmlelement, XMLPort::Mode mode) 80 85 { -
code/branches/weapon/src/orxonox/objects/WeaponSystem.h
r2049 r2060 50 50 void fire(int n); 51 51 void setActiveWeaponSet(int n); 52 WeaponSet * getWeaponSetPointer(int n); 52 53 53 54 inline void WeaponSystem::setParentSpaceShip(SpaceShip *parentSpaceShip) -
code/branches/weapon/src/orxonox/objects/weaponSystem/Weapon.h
r2049 r2060 46 46 47 47 void addMunition(); 48 v oid fire();48 virtual void fire(); 49 49 50 50 private: 51 51 int loadingTime; 52 52 Munition *munition_; 53 53 -
code/branches/weapon/src/orxonox/objects/weaponSystem/WeaponSet.cc
r2049 r2060 38 38 namespace orxonox 39 39 { 40 WeaponSet::WeaponSet( )40 WeaponSet::WeaponSet(int k) 41 41 { 42 42 RegisterObject(WeaponSet); 43 44 for (int i=0;i<k;i++) 45 { 46 this->wSlotNew = new WeaponSlot(); 47 attachWeaponSlot(wSlotNew); 48 } 43 49 } 44 50 … … 63 69 } 64 70 71 WeaponSlot * getWeaponSlotPointer(int n) 72 { 73 return this->weaponSlots_[n]; 74 } 75 76 65 77 void WeaponSet::XMLPort(Element& xmlelement, XMLPort::Mode mode) 66 78 { -
code/branches/weapon/src/orxonox/objects/weaponSystem/WeaponSet.h
r2049 r2060 43 43 { 44 44 public: 45 WeaponSet( );45 WeaponSet(int k); 46 46 virtual ~WeaponSet(); 47 47 … … 50 50 void WeaponSet::attachWeaponSlot(WeaponSlot *wSlot); 51 51 void WeaponSet::fire(); 52 WeaponSlot * getWeaponSlotPointer(int n); 53 52 54 inline void WeaponSet::setParentWeaponSystem(WeaponSystem *parentWeaponSystem) 53 55 { parentWeaponSystem_=parentWeaponSystem; } -
code/branches/weapon/src/orxonox/objects/weaponSystem/WeaponSlot.cc
r2049 r2060 59 59 void WeaponSlot::setAmmoType(bool isUnlimited) 60 60 { 61 if (isUnlimited == true) 62 unlimitedAmmo_ = true; 63 else unlimitedAmmo_ = false; 61 unlimitedAmmo_ = isUnlimited; 64 62 } 65 63 -
code/branches/weapon/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc
r2049 r2060 40 40 { 41 41 RegisterObject(LaserGun); 42 43 projectileColor_ = ColourValue(1.0, 1.0, 0.5) 42 44 } 43 45 … … 46 48 } 47 49 50 LaserGun::fire() 51 { 52 BillboardProjectile* projectile = new ParticleProjectile(this); 53 projectile->setColour(this->projectileColor_); 54 projectile->create(); 55 if (projectile->getClassID() == 0) 56 { 57 COUT(3) << "generated projectile with classid 0" << std::endl; // TODO: remove this output 58 } 59 60 projectile->setObjectMode(0x3); 61 } 62 48 63 LaserGun::addMunition() 49 64 { 50 this->munition_ =65 //this->munition_ = ; 51 66 } 52 67 … … 56 71 } 57 72 73 ColorValue LaserGun::getProjectileColor() 74 { 75 return projectileColor_; 76 } 58 77 } -
code/branches/weapon/src/orxonox/objects/weaponSystem/weapons/LaserGun.h
r2049 r2060 35 35 36 36 #include "LaserGunMunition.h" 37 #include "../tools/BillboardSet.h" 37 38 38 39 namespace orxonox … … 46 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 48 48 49 ColourValue LaserGun::getProjectileColour(); 49 50 50 51 private: 52 ColorValue projectileColor_; 51 53 52 54
Note: See TracChangeset
for help on using the changeset viewer.