Rev | Line | |
---|
[2202] | 1 | #include "core/Executor.h" |
---|
| 2 | |
---|
| 3 | namespace orxonox |
---|
| 4 | { |
---|
| 5 | |
---|
| 6 | bool pickedUp(Pawn* player) |
---|
| 7 | { |
---|
| 8 | if(player-> isA(playerBaseClass)) |
---|
| 9 | { |
---|
| 10 | Spaceship* ship = dynamic_cast <SpaceShip*>(player); |
---|
| 11 | setSpeedBoost(this->boost, this->duration, Spaceship* ship) |
---|
| 12 | return true; |
---|
| 13 | } |
---|
| 14 | return false; |
---|
| 15 | |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | void unsetSpeedBoost(int boost, Spaceship* ship) |
---|
| 20 | { |
---|
| 21 | ship->setMaxSpeed( ship->getMaxSpeed() - boost); |
---|
| 22 | ship->setTransAcc( ship->getTransAcc()/ACCBOOST); |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | void setSpeedBoost(float boost, float duration, Spaceship* ship) |
---|
| 26 | { |
---|
| 27 | const float ACCBOOST =1.5 |
---|
| 28 | ship->setMaxSpeed( ship->getMaxSpeed() + boost); |
---|
| 29 | ship->setTransAcc( ship->getTransAcc()*ACCBOOST); |
---|
| 30 | |
---|
| 31 | turbotimer_.setTimer(duration, false, this, createExecutor(createFunctor(&Turbo::unsetSpeedBoost))) |
---|
| 32 | |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | |
---|
Note: See
TracBrowser
for help on using the repository browser.