Line | |
---|
1 | |
---|
2 | |
---|
3 | |
---|
4 | #include "Wagnis.h" |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | namespace orxonox{ |
---|
9 | |
---|
10 | RegisterClass(Wagnis); |
---|
11 | |
---|
12 | //Constructor |
---|
13 | Wagnis::Wagnis(Context* context) : Deathmatch(context){ |
---|
14 | RegisterObject(Wagnis); |
---|
15 | this->gameBoard = nullptr; |
---|
16 | this->gameStage = NOT_READY; |
---|
17 | |
---|
18 | int n = 3; |
---|
19 | for(int i = 1;i <= n;i++){ |
---|
20 | WagnisPlayer* p = new WagnisPlayer(context); |
---|
21 | p->gameBoard = this->gameBoard; |
---|
22 | this->players.push_back(p); |
---|
23 | } |
---|
24 | } |
---|
25 | //Destructor |
---|
26 | Wagnis::~Wagnis(){} |
---|
27 | |
---|
28 | |
---|
29 | //Runs the game |
---|
30 | void Wagnis::start(){ |
---|
31 | //SUPER(Wagnis,start); |
---|
32 | this->createGame(); |
---|
33 | } |
---|
34 | |
---|
35 | //Tick |
---|
36 | void Wagnis::tick(float dt){ |
---|
37 | SUPER(Wagnis,tick,dt); |
---|
38 | } |
---|
39 | |
---|
40 | //Creates and links all needed classes |
---|
41 | void Wagnis::createGame(){\ |
---|
42 | orxout() << "Game creation started"; |
---|
43 | |
---|
44 | if(!findGameBoard()){ |
---|
45 | orxout() << "Error: GameBoard not found"; |
---|
46 | } |
---|
47 | |
---|
48 | this->gameBoard->initializeNeighbors(); |
---|
49 | orxout() << "Game creation finished"; |
---|
50 | } |
---|
51 | |
---|
52 | //Finds the pointer to the gameBoard |
---|
53 | bool Wagnis::findGameBoard(){ |
---|
54 | for (WagnisGameboard* gb : ObjectList<WagnisGameboard>()){ |
---|
55 | this->gameBoard = gb; |
---|
56 | orxout()<<"Gameboard pointer found and added"; |
---|
57 | return true; |
---|
58 | } |
---|
59 | return false; |
---|
60 | } |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | |
---|
70 | |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | } |
---|
75 | |
---|
76 | |
---|
77 | |
---|
78 | |
---|
Note: See
TracBrowser
for help on using the repository browser.