Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 29, 2008, 4:13:10 PM (16 years ago)
Author:
polakma
Message:

WeaponSystem, Projectile (kompiliert nicht)

Location:
code/branches/weapon/src/orxonox/objects
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • code/branches/weapon/src/orxonox/objects/BillboardProjectile.cc

    r1907 r2060  
    3838    CreateFactory(BillboardProjectile);
    3939
    40     BillboardProjectile::BillboardProjectile(SpaceShip* owner) : Projectile(owner)
     40    BillboardProjectile::BillboardProjectile(Weapon* owner) : Projectile(owner)
    4141    {
    4242        RegisterObject(BillboardProjectile);
  • code/branches/weapon/src/orxonox/objects/BillboardProjectile.h

    r1558 r2060  
    4141    {
    4242        public:
    43             BillboardProjectile(SpaceShip* owner = 0);
     43            BillboardProjectile(Weapon* owner = 0);
    4444            virtual ~BillboardProjectile();
    4545
  • code/branches/weapon/src/orxonox/objects/ParticleProjectile.cc

    r1907 r2060  
    3838    CreateFactory(ParticleProjectile);
    3939
    40     ParticleProjectile::ParticleProjectile(SpaceShip* owner) : BillboardProjectile(owner)
     40    ParticleProjectile::ParticleProjectile(Weapon* owner) : BillboardProjectile(owner)
    4141    {
    4242        RegisterObject(ParticleProjectile);
     
    7272        this->particles_->setEnabled(this->isVisible());
    7373    }
    74    
     74
    7575    bool ParticleProjectile::create(){
    7676      if(!Projectile::create())
  • code/branches/weapon/src/orxonox/objects/ParticleProjectile.h

    r1907 r2060  
    4141    {
    4242        public:
    43             ParticleProjectile(SpaceShip* owner = 0);
     43            ParticleProjectile(Weapon* owner = 0);
    4444            virtual ~ParticleProjectile();
    4545            virtual void changedVisibility();
    4646            void setConfigValues();
    47            
     47
    4848            virtual bool create();
    4949
  • code/branches/weapon/src/orxonox/objects/Projectile.cc

    r1907 r2060  
    4747    float Projectile::speed_s = 5000;
    4848
    49     Projectile::Projectile(SpaceShip* owner) : owner_(owner)
     49    Projectile::Projectile(Weapon* owner) : owner_(owner)
    5050    {
    5151        RegisterObject(Projectile);
     
    5757        this->setStatic(false);
    5858        this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL);
    59        
     59
    6060        if (this->owner_)
    6161        {
     
    124124        delete this;
    125125    }
    126    
     126
    127127    bool Projectile::create(){
    128128      return WorldEntity::create();
  • code/branches/weapon/src/orxonox/objects/Projectile.h

    r1907 r2060  
    4545            void destroyObject();
    4646            virtual void tick(float dt);
    47            
     47
    4848            virtual bool create();
    4949
     
    5252
    5353        protected:
    54             Projectile(SpaceShip* owner = 0);
     54            Projectile(Weapon* owner = 0);
    5555            SpaceShip* owner_;
    5656
  • code/branches/weapon/src/orxonox/objects/SpaceShip.cc

    r2049 r2060  
    142142
    143143        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
    144151    }
    145152
     
    474481        if (this->bLMousePressed_ && this->timeToReload_ <= 0)
    475482        {
    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);
    486484            this->timeToReload_ = this->reloadTime_;
    487485        }
  • code/branches/weapon/src/orxonox/objects/SpaceShip.h

    r1625 r2060  
    3838#include "RadarViewable.h"
    3939#include "tools/BillboardSet.h"
     40
     41#include "WeaponSystem.h"
    4042
    4143namespace orxonox
     
    181183            float mouseY_;
    182184
     185            //WeaponSystem
     186            WeaponSystem * weaponSystem_;
     187
    183188        protected:
    184189            bool myShip_;
  • code/branches/weapon/src/orxonox/objects/WeaponSystem.cc

    r2049 r2060  
    7777    }
    7878
     79    WeaponSet * getWeaponSetPointer(int n)
     80    {
     81        return this->weaponSets_[n];
     82    }
     83
    7984    void WeaponSystem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    8085    {
  • code/branches/weapon/src/orxonox/objects/WeaponSystem.h

    r2049 r2060  
    5050            void fire(int n);
    5151            void setActiveWeaponSet(int n);
     52            WeaponSet * getWeaponSetPointer(int n);
    5253
    5354            inline void WeaponSystem::setParentSpaceShip(SpaceShip *parentSpaceShip)
  • code/branches/weapon/src/orxonox/objects/weaponSystem/Weapon.h

    r2049 r2060  
    4646
    4747            void addMunition();
    48             void fire();
     48            virtual void fire();
    4949
    5050        private:
    51                         int loadingTime;
     51            int loadingTime;
    5252            Munition *munition_;
    5353
  • code/branches/weapon/src/orxonox/objects/weaponSystem/WeaponSet.cc

    r2049 r2060  
    3838namespace orxonox
    3939{
    40     WeaponSet::WeaponSet()
     40    WeaponSet::WeaponSet(int k)
    4141    {
    4242        RegisterObject(WeaponSet);
     43
     44        for (int i=0;i<k;i++)
     45        {
     46            this->wSlotNew = new WeaponSlot();
     47            attachWeaponSlot(wSlotNew);
     48        }
    4349    }
    4450
     
    6369    }
    6470
     71    WeaponSlot * getWeaponSlotPointer(int n)
     72    {
     73        return this->weaponSlots_[n];
     74    }
     75
     76
    6577    void WeaponSet::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    6678    {
  • code/branches/weapon/src/orxonox/objects/weaponSystem/WeaponSet.h

    r2049 r2060  
    4343    {
    4444        public:
    45             WeaponSet();
     45            WeaponSet(int k);
    4646            virtual ~WeaponSet();
    4747
     
    5050            void WeaponSet::attachWeaponSlot(WeaponSlot *wSlot);
    5151            void WeaponSet::fire();
     52            WeaponSlot * getWeaponSlotPointer(int n);
     53
    5254            inline void WeaponSet::setParentWeaponSystem(WeaponSystem *parentWeaponSystem)
    5355                { parentWeaponSystem_=parentWeaponSystem; }
  • code/branches/weapon/src/orxonox/objects/weaponSystem/WeaponSlot.cc

    r2049 r2060  
    5959    void WeaponSlot::setAmmoType(bool isUnlimited)
    6060    {
    61         if (isUnlimited == true)
    62             unlimitedAmmo_ = true;
    63         else unlimitedAmmo_ = false;
     61        unlimitedAmmo_ = isUnlimited;
    6462    }
    6563
  • code/branches/weapon/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc

    r2049 r2060  
    4040    {
    4141        RegisterObject(LaserGun);
     42
     43        projectileColor_ = ColourValue(1.0, 1.0, 0.5)
    4244    }
    4345
     
    4648    }
    4749
     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
    4863    LaserGun::addMunition()
    4964    {
    50         this->munition_ =
     65        //this->munition_ = ;
    5166    }
    5267
     
    5671    }
    5772
     73    ColorValue LaserGun::getProjectileColor()
     74    {
     75        return projectileColor_;
     76    }
    5877}
  • code/branches/weapon/src/orxonox/objects/weaponSystem/weapons/LaserGun.h

    r2049 r2060  
    3535
    3636#include "LaserGunMunition.h"
     37#include "../tools/BillboardSet.h"
    3738
    3839namespace orxonox
     
    4647            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4748
    48 
     49            ColourValue LaserGun::getProjectileColour();
    4950
    5051        private:
     52            ColorValue projectileColor_;
    5153
    5254
Note: See TracChangeset for help on using the changeset viewer.