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