- Timestamp:
- Dec 5, 2018, 11:54:24 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/WorldMap_HS18/src/orxonox/controllers/SMCoord.cc
r12131 r12151 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 * Joel Lingg 24 * Co-authors: 25 * ... 26 * 27 */ 28 1 29 #include "SMCoord.h" 2 30 3 31 namespace orxonox { 4 SMCoord::SMCoord() { 5 set(0); 32 SMCoord::SMCoord() { 33 set(0); 34 } 35 36 SMCoord::~SMCoord() { 37 38 } 39 40 SMCoord::SMCoord(int x) { 41 set(x); 42 } 43 44 //sets the index. the boundaries neeed to set higher when you want more games. 45 void SMCoord::set(int index) { 46 if (index < 0) { 47 this -> index = 0; 48 } else if (index > 3) { 49 this -> index = 3; 50 } else { 51 this -> index = index; 6 52 } 53 } 54 //Returns the 3dcoordinate of the symbol which is choosen at the moment 55 Vector3 SMCoord::get3dcoordinate() { 56 Vector3 coord; 57 switch (this -> index) { 58 case 0: 59 coord.x = 550; 60 coord.y = 300; 61 coord.z = 0; 62 break; 63 case 1: 64 coord.x = 600; 65 coord.y = 300; 66 coord.z = 0; 67 break; 68 case 2: 69 coord.x = 650; 70 coord.y = 300; 71 coord.z = 0; 72 break; 73 case 3: 74 coord.x = 700; 75 coord.y = 300; 76 coord.z = 0; 77 break; 7 78 8 SMCoord::~SMCoord() { 9 79 default: 80 coord.x = 550; 81 coord.y = 300; 82 coord.z = 0; 83 break; 10 84 } 85 return coord; 86 } 11 87 12 SMCoord::SMCoord(int x) { 13 set(x); 14 } 15 16 void SMCoord::set(int index) { 17 if(index<0) return; 18 if(index>8) return; 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; 77 } 78 79 int SMCoord::getIndex() { 80 return this->index; 81 } 88 int SMCoord::getIndex() { 89 return this -> index; 90 } 82 91 }
Note: See TracChangeset
for help on using the changeset viewer.