Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 12, 2010, 2:06:15 PM (14 years ago)
Author:
scheusso
Message:

some rocket related fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/src/modules/weapons/projectiles/Rocket.cc

    r7127 r7154  
    4141#include "controllers/Controller.h"
    4242#include "sound/WorldSound.h"
     43#include "Scene.h"
    4344
    4445namespace orxonox
     
    116117        if(this->isInitialized())
    117118        {
    118             if (GameMode::isMaster() && this->player_)
    119                 this->player_->stopTemporaryControl();
     119            if (GameMode::isMaster())
     120            {
     121                this->destructionEffect();
     122
     123                if (this->getPlayer() && this->getController())
     124                    this->player_->stopTemporaryControl();
     125            }
    120126
    121127            if ( this->defSndWpnEngine_ )
     
    140146    {
    141147        this->owner_ = owner;
    142         this->originalControllableEntity_ = this->owner_->getPlayer()->getControllableEntity();
    143148        this->player_ = this->owner_->getPlayer();
    144149        this->owner_->getPlayer()->startTemporaryControl(this);
     
    228233    void Rocket::fired(unsigned int firemode)
    229234    {
    230         if (this->owner_)
    231         {
    232             {
    233                 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    234                 effect->setPosition(this->getPosition());
    235                 effect->setOrientation(this->getOrientation());
    236                 effect->setDestroyAfterLife(true);
    237                 effect->setSource("Orxonox/explosion4");
    238                 effect->setLifetime(2.0f);
    239             }
    240 
    241             {
    242                 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    243                 effect->setPosition(this->getPosition());
    244                 effect->setOrientation(this->getOrientation());
    245                 effect->setDestroyAfterLife(true);
    246                 effect->setSource("Orxonox/smoke4");
    247                 effect->setLifetime(3.0f);
    248             }
     235//         if (this->owner_)
     236//         {
    249237            this->destroy();
    250         }
     238//         }
     239    }
     240   
     241    void Rocket::destructionEffect()
     242    {
     243        ParticleSpawner *effect1, *effect2;
     244        if( this->owner_ )
     245        {
     246            effect1 = new ParticleSpawner(this->owner_->getCreator());
     247            effect2 = new ParticleSpawner(this->owner_->getCreator());
     248        }
     249        else
     250        {
     251            effect1 = new ParticleSpawner(static_cast<BaseObject*>(this->getScene().get()));
     252            effect2 = new ParticleSpawner(static_cast<BaseObject*>(this->getScene().get()));
     253        }
     254       
     255        effect1->setPosition(this->getPosition());
     256        effect1->setOrientation(this->getOrientation());
     257        effect1->setDestroyAfterLife(true);
     258        effect1->setSource("Orxonox/explosion4");
     259        effect1->setLifetime(2.0f);
     260       
     261        effect2->setPosition(this->getPosition());
     262        effect2->setOrientation(this->getOrientation());
     263        effect2->setDestroyAfterLife(true);
     264        effect2->setSource("Orxonox/smoke4");
     265        effect2->setLifetime(3.0f);
    251266    }
    252267
Note: See TracChangeset for help on using the changeset viewer.