Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 30, 2008, 4:25:16 PM (16 years ago)
Author:
rgrieder
Message:

Disabled all spaceship effects per default.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/orxonox_tutorial/src/orxonox/objects/SpaceShip.cc

    r1855 r1859  
    205205    void SpaceShip::init()
    206206    {
    207         if (Settings::showsGraphics())
     207        if (this->hasSpecialEffects())
    208208        {
    209209            // START CREATING THRUSTERS
     
    258258
    259259            // START CREATING ADDITIONAL EFFECTS
    260             if (this->hasSpecialEffects())
    261             {
    262                 this->backlight_ = new Backlight(this->maxSpeed_, 0.8);
    263                 this->attachObject(this->backlight_);
    264                 this->backlight_->setPosition(-2.35, 0, 0.2);
    265                 this->backlight_->setColour(this->getProjectileColour());
    266 
    267                 this->smoke_ = new ParticleSpawner();
    268                 this->smoke_->setParticle("Orxonox/smoke5", LODParticle::normal, 0, 0, 3);
    269                 this->attachObject(this->smoke_);
    270 
    271                 this->fire_ = new ParticleSpawner();
    272                 this->fire_->setParticle("Orxonox/fire3", LODParticle::normal, 0, 0, 1);
    273                 this->attachObject(this->fire_);
    274             }
     260            this->backlight_ = new Backlight(this->maxSpeed_, 0.8);
     261            this->attachObject(this->backlight_);
     262            this->backlight_->setPosition(-2.35, 0, 0.2);
     263            this->backlight_->setColour(this->getProjectileColour());
     264
     265            this->smoke_ = new ParticleSpawner();
     266            this->smoke_->setParticle("Orxonox/smoke5", LODParticle::normal, 0, 0, 3);
     267            this->attachObject(this->smoke_);
     268
     269            this->fire_ = new ParticleSpawner();
     270            this->fire_->setParticle("Orxonox/fire3", LODParticle::normal, 0, 0, 1);
     271            this->attachObject(this->fire_);
    275272            // END CREATING ADDITIONAL EFFECTS
    276 
    277             if (!this->isExactlyA(Class(SpaceShipAI)))
    278             {
    279                 // START of testing crosshair
    280                 this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
    281                 this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
    282 
    283                 this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0));
    284                 this->chNearNode_->setInheritScale(false);
    285                 this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0));
    286                 this->chFarNode_->setInheritScale(false);
    287 
    288                 this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet());
    289                 this->chNearNode_->setScale(0.2, 0.2, 0.2);
    290 
    291                 this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet());
    292                 this->chFarNode_->setScale(0.4, 0.4, 0.4);
    293                 // END of testing crosshair
    294             }
    295         }
    296         // END of testing crosshair
     273        }
     274
     275        if (!this->isExactlyA(Class(SpaceShipAI)))
     276        {
     277            // START of testing crosshair
     278            this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
     279            this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
     280
     281            this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0));
     282            this->chNearNode_->setInheritScale(false);
     283            this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0));
     284            this->chFarNode_->setInheritScale(false);
     285
     286            this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet());
     287            this->chNearNode_->setScale(0.2, 0.2, 0.2);
     288
     289            this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet());
     290            this->chFarNode_->setScale(0.4, 0.4, 0.4);
     291            // END of testing crosshair
     292        }
    297293
    298294        createCamera();
     
    311307        SUPER(SpaceShip, changedVisibility);
    312308
    313         this->tt1_->setEnabled(this->isVisible());
    314         this->tt2_->setEnabled(this->isVisible());
    315         this->redBillboard_.setVisible(this->isVisible());
    316         this->greenBillboard_.setVisible(this->isVisible());
     309        if (this->hasSpecialEffects())
     310        {
     311            this->tt1_->setEnabled(this->isVisible());
     312            this->tt2_->setEnabled(this->isVisible());
     313            this->redBillboard_.setVisible(this->isVisible());
     314            this->greenBillboard_.setVisible(this->isVisible());
     315            this->rightThrusterFlare_.setVisible(this->isVisible());
     316            this->leftThrusterFlare_.setVisible(this->isVisible());
     317            this->smoke_->setVisible(this->isVisible());
     318            this->fire_->setVisible(this->isVisible());
     319            this->backlight_->setVisible(this->isVisible());
     320        }
    317321        this->crosshairNear_.setVisible(this->isVisible());
    318322        this->crosshairFar_.setVisible(this->isVisible());
    319         this->rightThrusterFlare_.setVisible(this->isVisible());
    320         this->leftThrusterFlare_.setVisible(this->isVisible());
    321         this->smoke_->setVisible(this->isVisible());
    322         this->fire_->setVisible(this->isVisible());
    323         this->backlight_->setVisible(this->isVisible());
    324323    }
    325324
     
    328327        SUPER(SpaceShip, changedActivity);
    329328
    330         this->tt1_->setEnabled(this->isVisible());
    331         this->tt2_->setEnabled(this->isVisible());
    332         this->redBillboard_.setVisible(this->isVisible());
    333         this->greenBillboard_.setVisible(this->isVisible());
     329        if (this->hasSpecialEffects())
     330        {
     331            this->tt1_->setEnabled(this->isVisible());
     332            this->tt2_->setEnabled(this->isVisible());
     333            this->redBillboard_.setVisible(this->isVisible());
     334            this->greenBillboard_.setVisible(this->isVisible());
     335            this->rightThrusterFlare_.setVisible(this->isVisible());
     336            this->leftThrusterFlare_.setVisible(this->isVisible());
     337        }
    334338        this->crosshairNear_.setVisible(this->isVisible());
    335339        this->crosshairFar_.setVisible(this->isVisible());
    336         this->rightThrusterFlare_.setVisible(this->isVisible());
    337         this->leftThrusterFlare_.setVisible(this->isVisible());
    338340    }
    339341
     
    445447            this->cam_->tick(dt);
    446448
    447         if (Settings::showsGraphics())
     449        if (this->hasSpecialEffects())
    448450        {
    449451            if (this->smoke_)
     
    565567            this->yaw(Radian(this->mouseYRotation_ * dt));
    566568
    567         if (this->acceleration_.x > 0)
    568         {
    569             this->tt1_->setEnabled(true);
    570             this->tt2_->setEnabled(true);
    571         }
    572         else
    573         {
    574             this->tt1_->setEnabled(false);
    575             this->tt2_->setEnabled(false);
     569        if (this->hasSpecialEffects())
     570        {
     571            if (this->acceleration_.x > 0)
     572            {
     573                this->tt1_->setEnabled(true);
     574                this->tt2_->setEnabled(true);
     575            }
     576            else
     577            {
     578                this->tt1_->setEnabled(false);
     579                this->tt2_->setEnabled(false);
     580            }
    576581        }
    577582
Note: See TracChangeset for help on using the changeset viewer.