Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 23, 2011, 3:50:13 PM (14 years ago)
Author:
dboehi
Message:

Changed boost to start on key press and stop on key release

Location:
code/branches/gameimmersion/src/orxonox/controllers
Files:
2 edited

Legend:

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

    r8379 r8541  
    5252    SetConsoleCommand("HumanController", __CC_fire_name,           &HumanController::fire          ).addShortcut().keybindMode(KeybindMode::OnHold);
    5353    SetConsoleCommand("HumanController", "reload",                 &HumanController::reload        ).addShortcut();
    54     SetConsoleCommand("HumanController", __CC_boost_name,          &HumanController::toggleBoost   ).addShortcut().keybindMode(KeybindMode::OnPress);
     54    //SetConsoleCommand("HumanController", __CC_boost_name,          &HumanController::toggleBoost   ).addShortcut().keybindMode(KeybindMode::OnPress);
     55    SetConsoleCommand("HumanController", "startBoost",             &HumanController::startBoost    ).addShortcut().keybindMode(KeybindMode::OnPress);
     56    SetConsoleCommand("HumanController", "stopBoost",              &HumanController::stopBoost     ).addShortcut().keybindMode(KeybindMode::OnRelease);
    5557    SetConsoleCommand("HumanController", "greet",                  &HumanController::greet         ).addShortcut();
    5658    SetConsoleCommand("HumanController", "switchCamera",           &HumanController::switchCamera  ).addShortcut();
     
    171173    /*static*/ void HumanController::toggleBoost()
    172174    {
     175        COUT(0) << "Toggling boost!";
    173176        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    174177            HumanController::localController_s->toggleBoosting();
     
    182185    void HumanController::toggleBoosting(void)
    183186    {
     187            /*
    184188        this->boosting_ = !this->boosting_;
    185189       
     
    190194            ModifyConsoleCommand(__CC_boost_name).keybindMode(KeybindMode::OnPress);
    191195
    192         this->controllableEntity_->boost(this->boosting_);
    193     }
     196        this->controllableEntity_->boost(this->boosting_);*/
     197    }
     198   
     199    void HumanController::startBoost()
     200    {
     201            COUT(0) << "Starting boost" << std::endl;
     202            if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     203                    HumanController::localController_s->setBoost(true);
     204    }
     205   
     206    void HumanController::stopBoost()
     207    {
     208            COUT(0) << "Stopping boost" << std::endl;
     209            if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     210                    HumanController::localController_s->setBoost(false);
     211    }
     212   
     213    void HumanController::setBoost(bool bBoost)
     214    {
     215            this->controllableEntity_->boost(bBoost);
     216    }       
    194217
    195218    void HumanController::greet()
  • code/branches/gameimmersion/src/orxonox/controllers/HumanController.h

    r8379 r8541  
    6464            static void reload();
    6565
     66            static void startBoost();
     67            static void stopBoost();
    6668            static void toggleBoost(); // Static method,toggles boosting.
     69            void setBoost(bool);
    6770            /**
    6871            @brief Check whether the HumanController is in boosting mode.
Note: See TracChangeset for help on using the changeset viewer.