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 | See TowerDefenseReadme.txt for Information. |
---|
32 | @ingroup TowerDefense |
---|
33 | */ |
---|
34 | |
---|
35 | |
---|
36 | #ifndef _TowerDefenseCenterpoint_H__ |
---|
37 | #define _TowerDefenseCenterpoint_H__ |
---|
38 | |
---|
39 | #include "towerdefense/TowerDefensePrereqs.h" |
---|
40 | |
---|
41 | #include <string> |
---|
42 | #include <util/Math.h> |
---|
43 | #include "TowerDefenseTower.h" |
---|
44 | #include "worldentities/MobileEntity.h" |
---|
45 | |
---|
46 | namespace orxonox |
---|
47 | { |
---|
48 | class _TowerDefenseExport TowerDefenseCenterpoint : public MobileEntity |
---|
49 | { |
---|
50 | public: |
---|
51 | TowerDefenseCenterpoint(Context* context); |
---|
52 | virtual ~TowerDefenseCenterpoint() {} |
---|
53 | |
---|
54 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; |
---|
55 | |
---|
56 | /** |
---|
57 | @brief The width and hight in number of tiles. Default is 15 for both. |
---|
58 | */ |
---|
59 | void setWidth(unsigned int width) |
---|
60 | { this->width_ = width; } |
---|
61 | unsigned int getWidth(void) const |
---|
62 | { return this->width_; } |
---|
63 | void setHeight(unsigned int height) |
---|
64 | { this->height_ = height; } |
---|
65 | unsigned int getHeight(void) const |
---|
66 | { return this->height_; } |
---|
67 | void setFields(const std::string& newFields) |
---|
68 | { this->fields_ = newFields; trimString(&fields_); } |
---|
69 | const std::string& getFields() const |
---|
70 | { return this->fields_; } |
---|
71 | void setSelecterTemplate(const std::string& newTemplate) |
---|
72 | { this->selecterTemplate_ = newTemplate; } |
---|
73 | const std::string& getSelecterTemplate() const |
---|
74 | { return this->selecterTemplate_; } |
---|
75 | |
---|
76 | void setTower1Template(const std::string& newTemplate) |
---|
77 | { this->towerTemplates_[0] = newTemplate;} |
---|
78 | const std::string& getTower1Template() const |
---|
79 | { return this->towerTemplates_[0]; } |
---|
80 | void setTower2Template(const std::string& newTemplate) |
---|
81 | { this->towerTemplates_[1] = newTemplate; } |
---|
82 | const std::string& getTower2Template() const |
---|
83 | { return this->towerTemplates_[1]; } |
---|
84 | void setTower3Template(const std::string& newTemplate) |
---|
85 | { this->towerTemplates_[2] = newTemplate; } |
---|
86 | const std::string& getTower3Template() const |
---|
87 | { return this->towerTemplates_[2]; } |
---|
88 | void setTower4Template(const std::string& newTemplate) |
---|
89 | { this->towerTemplates_[3] = newTemplate; } |
---|
90 | const std::string& getTower4Template() const |
---|
91 | { return this->towerTemplates_[3]; } |
---|
92 | void setTower5Template(const std::string& newTemplate) |
---|
93 | { this->towerTemplates_[4] = newTemplate; } |
---|
94 | const std::string& getTower5Template() const |
---|
95 | { return this->towerTemplates_[4]; } |
---|
96 | |
---|
97 | void setTower1Cost(const int& newCost) |
---|
98 | { this->towerCosts_[0] = newCost;} |
---|
99 | const int& getTower1Cost() const |
---|
100 | { return this->towerCosts_[0]; } |
---|
101 | void setTower2Cost(const int& newCost) |
---|
102 | { this->towerCosts_[1] = newCost; } |
---|
103 | const int& getTower2Cost() const |
---|
104 | { return this->towerCosts_[1]; } |
---|
105 | void setTower3Cost(const int& newCost) |
---|
106 | { this->towerCosts_[2] = newCost; } |
---|
107 | const int& getTower3Cost() const |
---|
108 | { return this->towerCosts_[2]; } |
---|
109 | void setTower4Cost(const int& newCost) |
---|
110 | { this->towerCosts_[3] = newCost; } |
---|
111 | const int& getTower4Cost() const |
---|
112 | { return this->towerCosts_[3]; } |
---|
113 | void setTower5Cost(const int& newCost) |
---|
114 | { this->towerCosts_[4] = newCost; } |
---|
115 | const int& getTower5Cost() const |
---|
116 | { return this->towerCosts_[4]; } |
---|
117 | |
---|
118 | const int getTowerCost(int upgrade) const; |
---|
119 | |
---|
120 | |
---|
121 | /** |
---|
122 | @brief How to convert to world coordinates, e.g. that 0,15 is not at -8,-8 but at -80,-80 (if scale would be 10) |
---|
123 | */ |
---|
124 | void setTileScale(unsigned int tileScale) |
---|
125 | { this->tileScale_ = tileScale; } |
---|
126 | |
---|
127 | unsigned int getTileScale(void) const |
---|
128 | { return this->tileScale_; } |
---|
129 | |
---|
130 | private: |
---|
131 | void checkGametype(); |
---|
132 | void trimString(std::string*); |
---|
133 | std::string selecterTemplate_; |
---|
134 | std::string towerTemplates_[5]; |
---|
135 | int towerCosts_[5]; |
---|
136 | std::string fields_; |
---|
137 | unsigned int width_; |
---|
138 | unsigned int height_; |
---|
139 | unsigned int tileScale_; |
---|
140 | }; |
---|
141 | } |
---|
142 | |
---|
143 | #endif /* _TowerDefenseCenterpoint_H__ */ |
---|