Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 9, 2011, 2:59:07 PM (13 years ago)
Author:
decryphe
Message:
  • Moved handling of blur effect from Engine.cc to SpaceShip.cc.
  • Implemented handling of multiple engines per SpaceShip, so that in future it would be possible to turn single engines on/off individually (for example if one gets destroyed on a big ship).
  • Updated some pointers accessing the single Engine of a SpaceShip to ask the SpaceShip itself instead for data.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/bigships/src/orxonox/controllers/HumanController.cc

    r8079 r8426  
    4242    extern const std::string __CC_fire_name = "fire";
    4343    extern const std::string __CC_suicide_name = "suicide";
     44    const std::string __CC_boost_name = "boost";
    4445
    4546    SetConsoleCommand("HumanController", "moveFrontBack",          &HumanController::moveFrontBack ).addShortcut().setAsInputCommand();
     
    5152    SetConsoleCommand("HumanController", __CC_fire_name,           &HumanController::fire          ).addShortcut().keybindMode(KeybindMode::OnHold);
    5253    SetConsoleCommand("HumanController", "reload",                 &HumanController::reload        ).addShortcut();
    53     SetConsoleCommand("HumanController", "boost",                  &HumanController::boost         ).addShortcut().keybindMode(KeybindMode::OnHold);
     54    SetConsoleCommand("HumanController", __CC_boost_name,          &HumanController::toggleBoost   ).addShortcut().keybindMode(KeybindMode::OnPress);
    5455    SetConsoleCommand("HumanController", "greet",                  &HumanController::greet         ).addShortcut();
    5556    SetConsoleCommand("HumanController", "switchCamera",           &HumanController::switchCamera  ).addShortcut();
     
    7273
    7374        controlPaused_ = false;
     75        this->boosting_ = false;
    7476
    7577        HumanController::localController_s = this;
     
    163165    }
    164166
    165     void HumanController::boost()
    166     {
    167         if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    168             HumanController::localController_s->controllableEntity_->boost();
     167    /**
     168    @brief
     169        Static method,toggles boosting.
     170    */
     171    /*static*/ void HumanController::toggleBoost()
     172    {
     173        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     174            HumanController::localController_s->toggleBoosting();
     175    }
     176   
     177    /**
     178    @brief
     179        Toggles the boosting mode.
     180        Changes the keybind mode of the boost console command and tells the ControllableEntity to boost (or not boost anymore).
     181    */
     182    void HumanController::toggleBoosting(void)
     183    {
     184        this->boosting_ = !this->boosting_;
     185       
     186        // The keybind mode of the boosting console command is onRelease if in boosting mode and onPress of not in boosting mode.
     187        if(this->boosting_)
     188            ModifyConsoleCommand(__CC_boost_name).keybindMode(KeybindMode::OnRelease);
     189        else
     190            ModifyConsoleCommand(__CC_boost_name).keybindMode(KeybindMode::OnPress);
     191
     192        this->controllableEntity_->boost(this->boosting_);
    169193    }
    170194
Note: See TracChangeset for help on using the changeset viewer.