Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 18, 2009, 1:34:14 PM (14 years ago)
Author:
scheusso
Message:

changes in PlayerInfo and Rocket (and scene)
not yet working in network though

File:
1 edited

Legend:

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

    r6086 r6087  
    5252        RegisterObject(Rocket);// - register the Rocket class to the core
    5353       
    54         this->setCollisionType(WorldEntity::Kinematic);
    55         this->setVelocity(0,0,-100);
    56         this->model_ = new Model(this);
    57         this->model_->setMeshSource("rocket_test.mesh");
    58         this->attach(this->model_);
    59         this->lifetime_ = 100;
    60         this->bDestroy_ = false;
    61        
    6254        if (GameMode::isMaster())
    6355        {
     56            this->setCollisionType(WorldEntity::Kinematic);
     57            this->setVelocity(0,0,-100);
     58            this->lifetime_ = 100;
     59            this->bDestroy_ = false;
     60       
     61            this->model_ = new Model(this);
     62            this->model_->setMeshSource("rocket_test.mesh");
     63            this->attach(this->model_);
     64       
    6465            this->enableCollisionCallback();
    6566            this->setCollisionResponse(false);
     
    7677        this->camPosition_ = new CameraPosition(this);
    7778        this->camPosition_->setPosition(0,10,40);
     79        this->camPosition_->setSyncMode(0x0);
    7880        this->attach( this->camPosition_ );
    7981        this->addCameraPosition( this->camPosition_ );
     
    8890        if(this->isInitialized())
    8991        {
    90             this->collisionShape_->destroy();
    91             this->model_->destroy();
    9292           
    93             if (GameMode::isMaster() && this->player_)
     93            if (GameMode::isMaster() && this->player_.get())
     94            {
     95                this->model_->destroy();
     96                this->collisionShape_->destroy();
    9497                this->player_->stopTemporaryControl();
     98            }
    9599            this->camPosition_->destroy();
    96100        }
     
    110114    {
    111115        this->owner_ = owner;
    112        
    113116        this->originalControllableEntity_ = this->owner_->getPlayer()->getControllableEntity();
    114117        this->player_ = this->owner_->getPlayer();
     
    126129        SUPER(Rocket, tick, dt);
    127130       
    128         this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_);
    129         this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() );
    130         this->localAngularVelocity_ = 0;
    131        
    132         if( this->bDestroy_ )
    133             this->destroy();
     131        if( GameMode::isMaster() )
     132        {
     133            this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_);
     134            this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() );
     135            this->localAngularVelocity_ = 0;
     136           
     137            if( this->bDestroy_ )
     138                this->destroy();
     139        }
    134140    }
    135141   
     
    180186            this->destroy();
    181187    }
     188   
     189    void Rocket::fire(unsigned int firemode)
     190    {
     191        if (this->owner_)
     192        {
     193            {
     194                ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
     195                effect->setPosition(this->getPosition());
     196                effect->setOrientation(this->getOrientation());
     197                effect->setDestroyAfterLife(true);
     198                effect->setSource("Orxonox/explosion3");
     199                effect->setLifetime(2.0f);
     200            }
     201            {
     202                ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
     203                effect->setPosition(this->getPosition());
     204                effect->setOrientation(this->getOrientation());
     205                effect->setDestroyAfterLife(true);
     206                effect->setSource("Orxonox/smoke4");
     207                effect->setLifetime(3.0f);
     208            }
     209            this->destroy();
     210        }
     211    }
    182212
    183213    /**
Note: See TracChangeset for help on using the changeset viewer.