Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 10, 2011, 11:09:36 AM (14 years ago)
Author:
dafrick
Message:

Streamlining boost.

Location:
code/branches/steering/src/orxonox/worldentities/pawns
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.cc

    r7860 r8223  
    5353        this->localAngularAcceleration_.setValue(0, 0, 0);
    5454        this->bBoost_ = false;
    55         this->bPermanentBoost_ = false;
    5655        this->steering_ = Vector3::ZERO;
    5756        this->engine_ = 0;
     
    103102        registerVariable(this->auxilaryThrust_, VariableDirection::ToClient);
    104103        registerVariable(this->rotationThrust_, VariableDirection::ToClient);
     104        registerVariable(this->boostPower_, VariableDirection::ToClient);
     105        registerVariable(this->boostPowerRate_, VariableDirection::ToClient);
     106        registerVariable(this->boostRate_, VariableDirection::ToClient);
     107        registerVariable(this->boostCooldownDuration_, VariableDirection::ToClient);
    105108    }
    106109
     
    207210    }
    208211
    209     // TODO: something seems to call this function every tick, could probably handled a little more efficiently!
    210     void SpaceShip::setBoost(bool bBoost)
    211     {
    212         if(bBoost == this->bBoost_)
    213             return;
    214 
    215         if(bBoost)
    216             this->boost();
    217         else
    218         {
     212    void SpaceShip::fire()
     213    {
     214    }
     215
     216    /**
     217    @brief
     218        Starts or stops boosting.
     219    @param bBoost
     220        Whether to start or stop boosting.
     221    */
     222    void SpaceShip::boost(bool bBoost)
     223    {
     224        if(bBoost && !this->bBoostCooldown_)
     225            this->bBoost_ = true;
     226        if(!bBoost)
    219227            this->bBoost_ = false;
    220         }
    221     }
    222 
    223     void SpaceShip::fire()
    224     {
    225     }
    226 
    227     void SpaceShip::boost()
    228     {
    229         if(!this->bBoostCooldown_)
    230             this->bBoost_ = true;
    231228    }
    232229
  • code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.h

    r7801 r8223  
    5959
    6060            virtual void fire();
    61             virtual void boost();
     61            virtual void boost(bool bBoost); // Starts or stops boosting.
    6262
    6363            void setEngine(Engine* engine);
     
    7070                { return this->steering_; }
    7171
    72             void setBoost(bool bBoost);
    7372            inline bool getBoost() const
    7473                { return this->bBoost_; }
     
    7978                { return this->enginetemplate_; }
    8079
    81             inline void setPermanentBoost(bool bPermanent)
    82                 { this->bPermanentBoost_ = bPermanent; }
    83             inline bool getPermanentBoost() const
    84                 { return this->bPermanentBoost_; }
    85 
    8680        protected:
    8781            virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const;
     
    9084            bool bBoost_;
    9185            bool bBoostCooldown_;
    92             bool bPermanentBoost_;
    9386            float boostPower_;
    9487            float initialBoostPower_;
Note: See TracChangeset for help on using the changeset viewer.