Changeset 12110 for code/branches/WorldMap_HS18/src/orxonox
- Timestamp:
- Nov 21, 2018, 11:45:27 AM (6 years ago)
- Location:
- code/branches/WorldMap_HS18/src/orxonox/controllers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/WorldMap_HS18/src/orxonox/controllers/SMCoord.cc
r12106 r12110 6 6 } 7 7 8 SMCoord::~SMCoord() { 9 10 } 11 8 12 SMCoord::SMCoord(int x) { 9 13 set(x); … … 11 15 12 16 void SMCoord::set(int index) { 17 if(index<0) return; 18 if(index>8) return; 13 19 this->index = index; 20 } 21 22 Vector3 SMCoord::get3dcoordinate() { 23 Vector3 coord; 24 switch(this->index) 25 { 26 case 0: 27 coord.x= 550; 28 coord.y = 300; 29 coord.z = 0; 30 break; 31 case 1: 32 coord.x= 100; 33 coord.y = 350; 34 coord.z = -250; 35 break; 36 case 2: 37 coord.x= -600; 38 coord.y = 250; 39 coord.z = -500; 40 break; 41 case 3: 42 coord.x= -1000; 43 coord.y = 50; 44 coord.z = -750; 45 break; 46 case 4: 47 coord.x= -900; 48 coord.y = -400; 49 coord.z = -1000; 50 break; 51 case 5: 52 coord.x= -500; 53 coord.y = -700; 54 coord.z = -1250; 55 break; 56 case 6: 57 coord.x= 0; 58 coord.y = 900; 59 coord.z = -1500; 60 break; 61 case 7: 62 coord.x= 700; 63 coord.y = -1100; 64 coord.z = -1750; 65 break; 66 case 8: 67 coord.x= 1500; 68 coord.y = 1300; 69 coord.z = -2000; 70 break; 71 default: 72 coord.x= 0; 73 coord.y = 0; 74 coord.z = 0; 75 } 76 return coord; 14 77 } 15 78 -
code/branches/WorldMap_HS18/src/orxonox/controllers/SMCoord.h
r12106 r12110 13 13 SMCoord(); 14 14 SMCoord(int x); 15 virtualvoid set(int index);15 void set(int index); 16 16 virtual int getIndex(); 17 virtual Vector3 get3dcoordinate(); 18 virtual ~SMCoord(); 19 17 20 18 21 private: -
code/branches/WorldMap_HS18/src/orxonox/controllers/StoryModeController.cc
r12106 r12110 31 31 #include "core/CoreIncludes.h" 32 32 #include "worldentities/ControllableEntity.h" 33 #include "graphics/Camera.h" 33 34 #include "SMCoord.h" 34 35 #include "core/XMLPort.h" 35 36 namespace orxonox 36 37 { 37 38 RegisterClass(StoryModeController); 38 39 39 StoryModeController::StoryModeController(Context* context) : ControllableEntity(context)40 StoryModeController::StoryModeController(Context* context) : SpaceShip(context) 40 41 { 41 42 RegisterObject(StoryModeController); 42 43 float time_; 43 moveForward_=false; 44 selectedPos_ = new SMCoord(0); 45 moveForward_= false; 44 46 moveBackward_=false; 45 47 boostPressed_=false; 46 setPosition(0); 48 49 47 50 48 51 } 49 50 52 StoryModeController::~StoryModeController() 51 53 { 52 54 delete selectedPos_; 55 selectedPos_ = nullptr; 53 56 54 57 } 55 58 56 59 void StoryModeController::updatePosition(){ 57 60 Vector3 pos = selectedPos_->get3dcoordinate(); 61 setPosition(pos); 58 62 } 59 void StoryModeController::set Position(int index){60 63 void StoryModeController::setLocation(int index){ 64 selectedPos_->set(index); 61 65 } 62 66 … … 64 68 { 65 69 orxout(internal_error) << "Hi" << endl; 66 SUPER(StoryModeController, tick, dt); 67 time_ +=dt; 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 } 68 87 69 88 … … 72 91 void StoryModeController::moveFrontBack(const Vector2& value) 73 92 { 74 93 orxout(internal_error) << "moveFrontBack" << endl; 75 94 } 95 96 void StoryModeController::chooseGame() 97 { 98 //findLevel(selectedPos_->getIndex()); 99 } 100 101 76 102 void StoryModeController::moveRightLeft(const Vector2& value) 77 103 { … … 87 113 } 88 114 89 void StoryModeController::rotateYaw(const Vector2& value){} 90 void StoryModeController::rotatePitch(const Vector2& value){} 91 void StoryModeController::rotateRoll(const Vector2& value){} 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 } 92 124 void StoryModeController::fire(unsigned int a){} 93 125 void StoryModeController::fired(unsigned int b){} 94 126 void StoryModeController::boost(bool bBoost){ 127 orxout(internal_error) << "Boost" << endl; 95 128 boostPressed_ = true; 96 129 } -
code/branches/WorldMap_HS18/src/orxonox/controllers/StoryModeController.h
r12106 r12110 36 36 #include "worldentities/ControllableEntity.h" 37 37 #include "worldentities/pawns/SpaceShip.h" 38 #include "SMCoord.h" 38 39 39 40 namespace orxonox 40 41 { 41 class _OrxonoxExport StoryModeController : public ControllableEntity42 class _OrxonoxExport StoryModeController : public SpaceShip 42 43 { 43 44 public: … … 54 55 virtual void fired(unsigned int firemode) override; 55 56 virtual void boost(bool bBoost) override; 56 virtual void set Position(int index);57 virtual void setLocation(int index); 57 58 bool moveRight_ ; 58 59 bool moveLeft_ ; 60 SMCoord* selectedPos_; 59 61 private: 60 62 virtual void updatePosition(); … … 63 65 bool moveBackward_; 64 66 bool boostPressed_; 67 virtual void chooseGame(); 65 68 66 69 };
Note: See TracChangeset
for help on using the changeset viewer.