Line | |
---|
1 | #include "TixyTaxyTorxyCoordinate.h" |
---|
2 | |
---|
3 | #include "TixyTaxyTorxy/TixyTaxyTorxyPrereqs.h" |
---|
4 | |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | namespace orxonox |
---|
9 | { |
---|
10 | /** |
---|
11 | @brief |
---|
12 | Constructor. Sets the default coordinates: (0,0) |
---|
13 | */ |
---|
14 | TixyTaxyTorxyCoordinate::TixyTaxyTorxyCoordinate() |
---|
15 | { |
---|
16 | Set(0,0); |
---|
17 | } |
---|
18 | |
---|
19 | TixyTaxyTorxyCoordinate::TixyTaxyTorxyCoordinate(int x, int y) |
---|
20 | { |
---|
21 | Set(x,y); |
---|
22 | |
---|
23 | } |
---|
24 | |
---|
25 | void TixyTaxyTorxyCoordinate::Set(int x, int y) |
---|
26 | { |
---|
27 | if (x < 0) |
---|
28 | { |
---|
29 | _x = 0; |
---|
30 | } |
---|
31 | else if (x > 10) |
---|
32 | { |
---|
33 | _x = 10; |
---|
34 | } |
---|
35 | else |
---|
36 | { |
---|
37 | _x = x; |
---|
38 | } |
---|
39 | |
---|
40 | if (y < 0) |
---|
41 | { |
---|
42 | _y = 0; |
---|
43 | } |
---|
44 | else if (y > 10) |
---|
45 | { |
---|
46 | _y = 10; |
---|
47 | } |
---|
48 | else |
---|
49 | { |
---|
50 | _y = y; |
---|
51 | } |
---|
52 | |
---|
53 | //Defniert die Positionen der einzelnen Minigames |
---|
54 | |
---|
55 | if( _x <= 2 && _y >= 8 ) _mini = 1; |
---|
56 | |
---|
57 | if( _x>= 4 &&_x <= 6 && _y >= 8 ) _mini = 2; |
---|
58 | |
---|
59 | if( _x>= 8 && _y >= 8 ) _mini = 3; |
---|
60 | |
---|
61 | if( _x <= 2 && _y >= 4 && _y<=6 ) _mini = 4; |
---|
62 | |
---|
63 | if(_x>=4 &&_x <= 6 && _y>=4 &&_y <= 6 ) _mini = 5; |
---|
64 | |
---|
65 | if( _x >=8 && _y >= 4 && _y<=6 ) _mini = 6; |
---|
66 | |
---|
67 | if( _x <= 2 && _y <=2 ) _mini = 7; |
---|
68 | |
---|
69 | if( _x >=4 &&_x <= 6 && _y <=2 ) _mini = 8; |
---|
70 | |
---|
71 | if( _x >= 8 && _y <=2 ) _mini = 9; |
---|
72 | } |
---|
73 | |
---|
74 | int TixyTaxyTorxyCoordinate::GetX() |
---|
75 | { |
---|
76 | return _x; |
---|
77 | } |
---|
78 | |
---|
79 | int TixyTaxyTorxyCoordinate::GetY() |
---|
80 | { |
---|
81 | return _y; |
---|
82 | } |
---|
83 | int TixyTaxyTorxyCoordinate::Getmini() |
---|
84 | { |
---|
85 | return _mini; |
---|
86 | } |
---|
87 | |
---|
88 | Vector3 TixyTaxyTorxyCoordinate::get3dcoordinate() |
---|
89 | { |
---|
90 | float tileScale = 100; |
---|
91 | |
---|
92 | Vector3 coord; |
---|
93 | coord.x= (_x-8) * tileScale; |
---|
94 | coord.y= (_y-8) * tileScale; |
---|
95 | coord.z=0; |
---|
96 | |
---|
97 | return coord; |
---|
98 | } |
---|
99 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.