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 | * |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | /** |
---|
30 | @brief |
---|
31 | GameType class for TowerDefense. See TowerDefenseReadme.txt for Information. |
---|
32 | |
---|
33 | @ingroup TowerDefense |
---|
34 | */ |
---|
35 | |
---|
36 | |
---|
37 | #ifndef _TowerDefense_H__ |
---|
38 | #define _TowerDefense_H__ |
---|
39 | #include "TDCoordinate.h" |
---|
40 | #include "towerdefense/TowerDefensePrereqs.h" |
---|
41 | #include "gametypes/Deathmatch.h" |
---|
42 | #include "TowerDefenseEnemy.h" |
---|
43 | #include "util/Output.h" |
---|
44 | |
---|
45 | |
---|
46 | #include "TowerDefensePlayerStats.h" |
---|
47 | |
---|
48 | namespace orxonox |
---|
49 | { |
---|
50 | class _TowerDefenseExport TowerDefense : public Deathmatch |
---|
51 | { |
---|
52 | public: |
---|
53 | TowerDefense(Context* context); |
---|
54 | virtual ~TowerDefense(); |
---|
55 | |
---|
56 | std::vector<orxonox::WeakPtr<TowerDefenseEnemy> > TowerDefenseEnemyvector; |
---|
57 | bool towermatrix[16][16]; |
---|
58 | void addTowerDefenseEnemy(std::vector<TDCoordinate*> path, int templatenr); |
---|
59 | virtual void start(); //<! The function is called when the gametype starts |
---|
60 | virtual void end(); |
---|
61 | virtual void tick(float dt); |
---|
62 | //virtual void playerEntered(PlayerInfo* player); |
---|
63 | //virtual bool playerLeft(PlayerInfo* player); |
---|
64 | //Player Stats (set,get, reduce) |
---|
65 | int getCredit(){ return this->credit_; } |
---|
66 | int getLifes(){ return this->lifes_; } |
---|
67 | int getWaveNumber(){ return this->waves_; } |
---|
68 | void setCredit(int credit){ credit_ = credit; } |
---|
69 | void setLifes(int lifes){ lifes_ = lifes; } |
---|
70 | void setWaveNumber(int wavenumber){waves_=wavenumber; } |
---|
71 | void buyTower(int cost){ credit_ -= cost;} |
---|
72 | void addCredit(int credit) { credit_+=credit; } |
---|
73 | void nextwave(){ waves_++;} |
---|
74 | int reduceLifes(int NumberofLifes){ return lifes_-=NumberofLifes; } |
---|
75 | |
---|
76 | //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); |
---|
77 | //virtual void playerScored(PlayerInfo* player, int score); |
---|
78 | |
---|
79 | |
---|
80 | /* Called by TowerDefenseCenterpoint upon game start |
---|
81 | The centerpoint is used to create towers |
---|
82 | */ |
---|
83 | void setCenterpoint(TowerDefenseCenterpoint *centerpoint); |
---|
84 | |
---|
85 | /* Adds a tower at x, y in the playfield */ |
---|
86 | void addTower(int x, int y); |
---|
87 | |
---|
88 | void upgradeTower(int x, int y); |
---|
89 | /* Part of a temporary hack to allow the player to add towers */ |
---|
90 | ConsoleCommand* dedicatedAddTower_; |
---|
91 | ConsoleCommand* dedicatedUpgradeTower_; |
---|
92 | |
---|
93 | //TODO: void spawnNewWave() |
---|
94 | //TODO: create a timer which regularly calls the spawnNewWave function (time driven) |
---|
95 | // or spawn a new wave when the old wave has been killed (event driven) |
---|
96 | |
---|
97 | |
---|
98 | private: |
---|
99 | TowerDefenseCenterpoint *center_; |
---|
100 | float time; |
---|
101 | float time2; |
---|
102 | int credit_; |
---|
103 | int waves_; |
---|
104 | int lifes_; |
---|
105 | |
---|
106 | /* handles stats */ |
---|
107 | bool hasEnoughCreditForTower(int towerCost); |
---|
108 | bool hasEnoughCreditForUpgrade(); |
---|
109 | |
---|
110 | std::vector<TowerTurret*> towers_; |
---|
111 | }; |
---|
112 | } |
---|
113 | |
---|
114 | #endif /* _TowerDefense_H__ */ |
---|