Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc @ 12124

Last change on this file since 12124 was 12124, checked in by stadlero, 5 years ago

Wagnis class wip

File size: 1.2 KB
Line 
1
2
3
4#include "Wagnis.h"
5
6
7
8namespace orxonox{
9
10RegisterClass(Wagnis);
11
12//Constructor
13Wagnis::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
26Wagnis::~Wagnis(){}
27
28
29//Runs the game
30void Wagnis::start(){
31    //SUPER(Wagnis,start);
32    this->createGame();
33}
34
35//Tick
36void Wagnis::tick(float dt){
37    SUPER(Wagnis,tick,dt);
38}
39
40//Creates and links all needed classes
41void 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
53bool 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.