[12060] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * Fabian 'x3n' Landau |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #include "StoryModeController.h" |
---|
| 30 | |
---|
| 31 | #include "core/CoreIncludes.h" |
---|
| 32 | #include "worldentities/ControllableEntity.h" |
---|
[12110] | 33 | #include "graphics/Camera.h" |
---|
[12106] | 34 | #include "SMCoord.h" |
---|
[12110] | 35 | #include "core/XMLPort.h" |
---|
[12060] | 36 | namespace orxonox |
---|
| 37 | { |
---|
| 38 | RegisterClass(StoryModeController); |
---|
| 39 | |
---|
[12110] | 40 | StoryModeController::StoryModeController(Context* context) : SpaceShip(context) |
---|
[12060] | 41 | { |
---|
| 42 | RegisterObject(StoryModeController); |
---|
[12106] | 43 | float time_; |
---|
[12110] | 44 | selectedPos_ = new SMCoord(0); |
---|
| 45 | moveForward_= false; |
---|
[12106] | 46 | moveBackward_=false; |
---|
| 47 | boostPressed_=false; |
---|
[12110] | 48 | |
---|
| 49 | |
---|
[12106] | 50 | |
---|
[12060] | 51 | } |
---|
| 52 | StoryModeController::~StoryModeController() |
---|
| 53 | { |
---|
[12110] | 54 | delete selectedPos_; |
---|
| 55 | selectedPos_ = nullptr; |
---|
[12101] | 56 | |
---|
[12060] | 57 | } |
---|
| 58 | |
---|
[12106] | 59 | void StoryModeController::updatePosition(){ |
---|
[12110] | 60 | Vector3 pos = selectedPos_->get3dcoordinate(); |
---|
| 61 | setPosition(pos); |
---|
[12106] | 62 | } |
---|
[12110] | 63 | void StoryModeController::setLocation(int index){ |
---|
| 64 | selectedPos_->set(index); |
---|
[12106] | 65 | } |
---|
| 66 | |
---|
[12060] | 67 | void StoryModeController::tick(float dt) |
---|
| 68 | { |
---|
[12101] | 69 | orxout(internal_error) << "Hi" << endl; |
---|
[12110] | 70 | SUPER(StoryModeController, tick, dt); |
---|
| 71 | time_ +=dt; |
---|
| 72 | |
---|
| 73 | if(moveForward_ == true){ |
---|
| 74 | moveForward_ = false; |
---|
| 75 | selectedPos_->set(selectedPos_->getIndex()+1); |
---|
| 76 | updatePosition(); |
---|
| 77 | } |
---|
| 78 | if(moveBackward_ == true){ |
---|
| 79 | moveBackward_ = false; |
---|
| 80 | selectedPos_->set(selectedPos_->getIndex()-1); |
---|
| 81 | updatePosition(); |
---|
| 82 | } |
---|
| 83 | if(boostPressed_ == true){ |
---|
| 84 | boostPressed_ = false; |
---|
| 85 | chooseGame(); |
---|
| 86 | } |
---|
[12106] | 87 | |
---|
| 88 | |
---|
[12060] | 89 | } |
---|
| 90 | |
---|
[12101] | 91 | void StoryModeController::moveFrontBack(const Vector2& value) |
---|
| 92 | { |
---|
[12110] | 93 | orxout(internal_error) << "moveFrontBack" << endl; |
---|
[12101] | 94 | } |
---|
[12110] | 95 | |
---|
| 96 | void StoryModeController::chooseGame() |
---|
| 97 | { |
---|
| 98 | //findLevel(selectedPos_->getIndex()); |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | |
---|
[12101] | 102 | void StoryModeController::moveRightLeft(const Vector2& value) |
---|
| 103 | { |
---|
| 104 | orxout(internal_error) << "RightLeft" << endl; |
---|
| 105 | if (value.x>0){ |
---|
[12106] | 106 | moveForward_ =false; |
---|
| 107 | moveBackward_ =true; |
---|
| 108 | } else { |
---|
| 109 | moveBackward_ = false; |
---|
| 110 | moveForward_ = true; |
---|
| 111 | } |
---|
[12101] | 112 | |
---|
| 113 | } |
---|
| 114 | |
---|
[12110] | 115 | void StoryModeController::rotateYaw(const Vector2& value){ |
---|
| 116 | orxout(internal_error) << "RightLeft" << endl; |
---|
| 117 | } |
---|
| 118 | void StoryModeController::rotatePitch(const Vector2& value){ |
---|
| 119 | orxout(internal_error) << "RightLeft" << endl; |
---|
| 120 | } |
---|
| 121 | void StoryModeController::rotateRoll(const Vector2& value){ |
---|
| 122 | orxout(internal_error) << "RightLeft" << endl; |
---|
| 123 | } |
---|
[12101] | 124 | void StoryModeController::fire(unsigned int a){} |
---|
| 125 | void StoryModeController::fired(unsigned int b){} |
---|
[12106] | 126 | void StoryModeController::boost(bool bBoost){ |
---|
[12110] | 127 | orxout(internal_error) << "Boost" << endl; |
---|
[12106] | 128 | boostPressed_ = true; |
---|
| 129 | } |
---|
[12060] | 130 | } |
---|