Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/WorldMap_HS18/src/orxonox/controllers/StoryModeController.cc @ 12110

Last change on this file since 12110 was 12110, checked in by linggj, 5 years ago

some changes

File size: 3.7 KB
Line 
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"
33#include "graphics/Camera.h"
34#include "SMCoord.h"
35#include "core/XMLPort.h"
36namespace orxonox
37{
38    RegisterClass(StoryModeController);
39
40   StoryModeController::StoryModeController(Context* context) : SpaceShip(context)
41    {
42        RegisterObject(StoryModeController);
43        float time_;
44        selectedPos_ = new SMCoord(0);
45        moveForward_= false;
46        moveBackward_=false;                     
47        boostPressed_=false;
48       
49
50     
51    }
52    StoryModeController::~StoryModeController()
53    {
54        delete selectedPos_;
55        selectedPos_ = nullptr;
56
57    }
58
59    void StoryModeController::updatePosition(){
60        Vector3 pos = selectedPos_->get3dcoordinate();
61        setPosition(pos);
62    }
63    void StoryModeController::setLocation(int index){
64         selectedPos_->set(index);
65    }
66
67    void StoryModeController::tick(float dt)
68    {
69        orxout(internal_error) << "Hi" << endl;
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           }
87       
88       
89    }
90
91    void StoryModeController::moveFrontBack(const Vector2& value)
92    {
93           orxout(internal_error) << "moveFrontBack" << endl;         
94    }
95
96    void StoryModeController::chooseGame()
97    {
98           //findLevel(selectedPos_->getIndex());           
99    }
100
101
102    void StoryModeController::moveRightLeft(const Vector2& value)
103    {
104        orxout(internal_error) << "RightLeft" << endl; 
105        if (value.x>0){
106            moveForward_ =false;
107            moveBackward_ =true;
108        } else {
109            moveBackward_ = false;
110            moveForward_ = true;
111        }
112
113    }
114
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    }
124    void StoryModeController::fire(unsigned int a){}
125    void StoryModeController::fired(unsigned int b){}
126    void StoryModeController::boost(bool bBoost){
127        orxout(internal_error) << "Boost" << endl; 
128        boostPressed_ = true;
129    }
130}
Note: See TracBrowser for help on using the repository browser.