Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.h @ 10802

Last change on this file since 10802 was 10629, checked in by fvultier, 9 years ago

Merged towerdefenseFabien branch back to trunk. The towerdefense Minigame is now a plugin.

  • Property svn:eol-style set to native
File size: 5.4 KB
RevLine 
[9110]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/**
[9141]30 @brief
31 See TowerDefenseReadme.txt for Information.
32 @ingroup TowerDefense
33 */
[9110]34
[9141]35
[9110]36#ifndef _TowerDefenseCenterpoint_H__
37#define _TowerDefenseCenterpoint_H__
38
[9112]39#include "towerdefense/TowerDefensePrereqs.h"
[9110]40
41#include <string>
42#include <util/Math.h>
[10629]43#include "TowerDefenseTower.h"
[9175]44#include "worldentities/MobileEntity.h"
[9110]45
46namespace orxonox
47{
[9175]48    class _TowerDefenseExport TowerDefenseCenterpoint : public MobileEntity
[9110]49    {
50        public:
[9667]51            TowerDefenseCenterpoint(Context* context);
[9110]52            virtual ~TowerDefenseCenterpoint() {}
53
[9141]54            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
[9272]55
[9110]56            /**
[9141]57            @brief The width and hight in number of tiles. Default is 15 for both.
[9110]58            */
59            void setWidth(unsigned int width)
60                { this->width_ = width; }
[9272]61            unsigned int getWidth(void) const
[9110]62                { return this->width_; }
63            void setHeight(unsigned int height)
64                { this->height_ = height; }
[9272]65            unsigned int getHeight(void) const
[9110]66                { return this->height_; }
[10629]67            void setFields(const std::string& newFields)
68                { this->fields_ = newFields; trimString(&fields_); }
69            const std::string& getFields() const
70                { return this->fields_; }                   
[10622]71            void setSelecterTemplate(const std::string& newTemplate)
72                { this->selecterTemplate_ = newTemplate; }
73            const std::string& getSelecterTemplate() const
74                { return this->selecterTemplate_; }   
[10629]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
[9110]121            /**
[9272]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
[9110]130        private:
[9141]131            void checkGametype();
[10629]132            void trimString(std::string*);
[10622]133            std::string selecterTemplate_;
[10629]134            std::string towerTemplates_[5];
135            int towerCosts_[5];
136            std::string fields_;
[9110]137            unsigned int width_;
138            unsigned int height_;
[9272]139            unsigned int tileScale_;
[9110]140    };
141}
142
143#endif /* _TowerDefenseCenterpoint_H__ */
Note: See TracBrowser for help on using the repository browser.