Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/mergeFS18/src/modules/wagnis/WagnisHUDinfo.cc @ 12406

Last change on this file since 12406 was 12172, checked in by kunzro, 6 years ago

Colour untill 6 adjusted and CHOOSE_PROVINCE_STAGE fixed, so it only ends, if all the provinces are occupied also if some players don' play

File size: 3.7 KB
Line 
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 *      Roman Kunz
24 *
25 */
26
27#include "WagnisHUDinfo.h"
28
29#include "core/CoreIncludes.h"
30#include "core/XMLPort.h"
31#include "util/Convert.h"
32#include <string>
33
34namespace orxonox
35{
36    RegisterClass(WagnisHUDinfo);
37
38    WagnisHUDinfo::WagnisHUDinfo(Context* context) : OverlayText(context)
39    {
40        RegisterObject(WagnisHUDinfo);
41
42        this->wagnisgame = nullptr;
43        this->bShow_ = false;
44    }
45
46    void WagnisHUDinfo::tick(float dt)
47    {
48        SUPER(WagnisHUDinfo, tick, dt);
49        if(wagnisgame==nullptr){
50            findWagnis();
51        }
52        switch(wagnisgame->active_player){
53            case 1: setColour( colour({255,0,0}, 100.0f) );
54                    break;
55            case 2: setColour( colour({0,255,0}, 100.0f) );
56                    break;
57            case 3: setColour( colour({255,255,0}, 100.0f) );
58                    break;
59            case 4: setColour( colour({0,0,255}, 100.0f) );
60                    break;
61            case 5: setColour( colour({255,0,255}, 100.0f) );
62                    break;
63            case 6: setColour( colour({0,255,255}, 40.0f) );
64                    break;
65            case 7: setColour( colour({128,128,0}, 100.0f) );
66                    break;
67            case 8: setColour( colour({153,255,204}, 100.0f) );
68                    break;
69            case 9: setColour( colour({102,51,0}, 100.0f) );
70                    break;
71        }
72
73        std::stringstream ss;
74        switch(wagnisgame->gameStage){
75            case CHOOSE_PROVINCE_STAGE: {
76                ss<<"Player "<<wagnisgame->active_player<<" choose a province to occupy";
77                setCaption( ss.str() );
78                break;
79            }
80            case REINFORCEMENT_STAGE: {
81                ss<<"Player "<<wagnisgame->active_player<<" place your reinforcements: "<<wagnisgame->players.at(wagnisgame->active_player-1)->reinforcements;
82                setCaption( ss.str() );
83                break;
84            }
85            case ATTACK_STAGE: {
86                ss<<"Player "<<wagnisgame->active_player<<" you can attack now";
87                setCaption( ss.str() );
88                break;
89            }
90            case MOVE_STAGE: {
91                ss<<"Player "<<wagnisgame->active_player<<" you can reorganize your troops now";
92                setCaption( ss.str() );
93                break;
94            }
95            case NOT_READY: {
96                ss<<"";
97                setCaption( ss.str() );
98                break;
99            }
100            case WINNER_STAGE: {
101                ss<<"PLAYER "<<wagnisgame->active_player<<" WINS!!!";
102                setCaption( ss.str() );
103                break;
104            }
105            default: {}
106        }
107    }
108    void WagnisHUDinfo::findWagnis(){
109    for (Wagnis* gb : ObjectList<Wagnis>()){
110        this->wagnisgame = gb;
111        orxout()<<"Wagnis pointer found and added"<<endl;
112        return;
113    }
114}
115}
Note: See TracBrowser for help on using the repository browser.