Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 26, 2008, 2:17:18 PM (16 years ago)
Author:
polakma
Message:

pojectile compiles.

Location:
code/branches/weapon2/src/orxonox/objects/weaponSystem
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.h

    r2232 r2272  
    5151
    5252            virtual void fire();
     53            void attachNeededMunition(std::string munitionType);
     54            virtual void setParentWeaponSystem();
     55            Munition * getAttachedMunition();
     56
     57            //reloading
    5358            void bulletTimer();
    5459            void magazineTimer();
    5560            void bulletReloaded();
    5661            void magazineReloaded();
    57             void attachNeededMunition(std::string munitionType);
    58 
    59             //get and set functions
    60             virtual void setParentWeaponSystem();
    61             Munition * getAttachedMunition();
    6262            void setBulletLoadingTime(float loadingTime);
    6363            float getBulletLoadingTime();
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSystem.cc

    r2203 r2272  
    8585*/
    8686
     87
    8788    //n is the n'th weaponSet, starting with zero
    8889    //SpaceShip.cc only needs to have the keybinding to a specific Set-number n
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.cc

    r2232 r2272  
    3838    CreateFactory(BillboardProjectile);
    3939
    40     BillboardProjectile::BillboardProjectile(BaseObject* creator, Weapon* owner) : Projectile(creator, owner)
     40    BillboardProjectile::BillboardProjectile(BaseObject* creator) : Projectile(creator)
    4141    {
    4242        RegisterObject(BillboardProjectile);
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.h

    r2232 r2272  
    4141    {
    4242        public:
    43             BillboardProjectile(BaseObject* creator, Weapon* owner = 0);
     43            BillboardProjectile(BaseObject* creator);
    4444            virtual ~BillboardProjectile();
    4545
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.cc

    r2232 r2272  
    3838    CreateFactory(ParticleProjectile);
    3939
    40     ParticleProjectile::ParticleProjectile(BaseObject* creator, Weapon* owner) : BillboardProjectile(creator, owner)
     40    ParticleProjectile::ParticleProjectile(BaseObject* creator) : BillboardProjectile(creator)
    4141    {
    4242        RegisterObject(ParticleProjectile);
     
    4545        this->particles_->addToSceneNode(this->getNode());
    4646        this->particles_->setKeepParticlesInLocalSpace(true);
     47
     48        /*
    4749        if (this->owner_)
    4850        {
     
    5254//            this->particles_ = 0;
    5355//        }
     56        */
    5457
    5558        this->setConfigValues();
     
    6467    void ParticleProjectile::setConfigValues()
    6568    {
    66         SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback((Projectile*)this, &ParticleProjectile::speedChanged);
     69        //SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback((Projectile*)this, &ParticleProjectile::speedChanged);
    6770    }
    6871
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.h

    r2099 r2272  
    4141    {
    4242        public:
    43             ParticleProjectile(BaseObject* creator, Weapon* owner = 0);
     43            ParticleProjectile(BaseObject* creator);
    4444            virtual ~ParticleProjectile();
    4545            virtual void changedVisibility();
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc

    r2232 r2272  
    4040#include "objects/worldentities/Model.h"
    4141#include "objects/worldentities/ParticleSpawner.h"
    42 #include "Settings.h"
     42#include "core/Core.h"
    4343
    4444namespace orxonox
    4545{
    46     float Projectile::speed_s = 5000;
    47 
    48     Projectile::Projectile(BaseObject* creator, Weapon* owner) : MovableEntity(creator), owner_(owner)
     46    Projectile::Projectile(BaseObject* creator) : MovableEntity(creator)
    4947    {
    5048        RegisterObject(Projectile);
     
    5755        this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL);
    5856
     57        /*
    5958        if (this->owner_)
    6059        {
     
    6362            this->setVelocity(this->owner_->getInitialDir() * this->speed_);
    6463        }
     64        */
    6565
    66         if(!orxonox::Settings::isClient()) //only if not on client
     66        if(!Core::isClient()) //only if not on client
    6767          this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject)));
    6868    }
     
    7676        SetConfigValue(damage_, 15.0).description("The damage caused by the projectile");
    7777        SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive");
    78         SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback(this, &Projectile::speedChanged);
    7978    }
    8079
    81     void Projectile::speedChanged()
    82     {
    83         Projectile::speed_s = this->speed_;
    84         if (this->owner_)
    85             this->setVelocity(this->owner_->getInitialDir() * this->speed_);
    86     }
    8780
    8881    void Projectile::tick(float dt)
     
    10396                {
    10497                    // hit
    105                     ParticleSpawner* explosion = new ParticleSpawner(this->explosionTemplateName_, LODParticle::low, 2.0);
     98                    ParticleSpawner* explosion = new ParticleSpawner(this);
     99                    explosion->setSource(this->explosionTemplateName_);
     100                    explosion->setLOD(LODParticle::low);
     101                    explosion->configure(2.0);
    106102                    explosion->setPosition(this->getPosition());
    107103                    explosion->create();
    108                     ParticleSpawner* smoke = new ParticleSpawner(this->smokeTemplateName_, LODParticle::normal, 2.0, 0.0);
     104                    ParticleSpawner* smoke = new ParticleSpawner(this);
     105                    smoke->setSource(this->smokeTemplateName_);
     106                    smoke->setLOD(LODParticle::normal);
     107                    smoke->configure(2.0, 0.0);
    109108                    smoke->setPosition(this->getPosition());
    110109//                    smoke->getParticleInterface()->setSpeedFactor(3.0);
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/Projectile.h

    r2099 r2272  
    4242            virtual ~Projectile();
    4343            void setConfigValues();
    44             void speedChanged();
    4544            void destroyObject();
    4645            virtual void tick(float dt);
     
    4847            virtual bool create();
    4948
    50             static float getSpeed()
    51                 { return Projectile::speed_s; }
    52 
    5349        protected:
    54             Projectile(BaseObject* creator, Weapon* owner = 0);
    55             SpaceShip* owner_;
     50            Projectile(BaseObject* creator);
    5651
    5752        private:
     
    5954            std::string smokeTemplateName_;
    6055        protected:
    61             static float speed_s;
    6256            float speed_;
    6357        private:
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc

    r2232 r2272  
    4646        //this->setLoadingTime(0.5);
    4747
    48         //Hack --> will be loaded by XML
     48        //how could it be loaded by XML
    4949        this->attachNeededMunition("LaserGunMunition");
    5050    }
     
    5858        if ( this->getBulletReadyToShoot() && this->getMagazineReadyToShoot() )
    5959        {
    60 
    61 
    62 
    6360            //take munition
    6461            this->getAttachedMunition()->removeBullets(1,this);
     
    6764
    6865            //create projectile
    69             BillboardProjectile* projectile = new ParticleProjectile(this,this);
     66            BillboardProjectile* projectile = new ParticleProjectile(this);
     67            projectile->setOrientation(projectile->getOrientation());
     68            projectile->setPosition(projectile->getWorldPosition());
     69            projectile->setVelocity(WorldEntity::FRONT * this->speed_);
     70
    7071            //projectile->setColour(this->getProjectileColour());
    7172        }
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.h

    r2203 r2272  
    5353
    5454        private:
     55            float speed_;
    5556
    5657
Note: See TracChangeset for help on using the changeset viewer.