Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.h @ 9123

Last change on this file since 9123 was 9112, checked in by jo, 13 years ago

Created minimal working version for the TowerDefence module. The code compiles and the level runs. Unfortunately an 'Playfield_ME.mesh' cannot be loaded on my machine.

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 *      ...
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file TowerDefenseCenterpoint.h
31    @brief Declaration of the TowerDefenseCenterpoint class.
32    @ingroup TowerDefense
33*/
34
35#ifndef _TowerDefenseCenterpoint_H__
36#define _TowerDefenseCenterpoint_H__
37
38#include "towerdefense/TowerDefensePrereqs.h"
39
40#include <string>
41
42#include <util/Math.h>
43
44#include "worldentities/StaticEntity.h"
45
46namespace orxonox
47{
48   
49    /**
50    @brief
51       
52   
53    @author
54       
55    @ingroup TowerDefense
56    */
57    class _TowerDefenseExport TowerDefenseCenterpoint : public StaticEntity
58    {
59        public:
60            TowerDefenseCenterpoint(BaseObject* creator); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually TowerDefense.
61            virtual ~TowerDefenseCenterpoint() {}
62
63            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a TowerDefenseCenterpoint through XML.
64
65            virtual void changedGametype(); //!< Is called when the gametype has changed.
66           
67            /**
68            @brief Set the width of the playing field.
69            @param width The width in number of tiles.
70            */
71            void setWidth(unsigned int width)
72                { this->width_ = width; }
73            /**
74            @brief Get the width of the playing field.
75            @return Returns the width in number of tiles.
76            */
77            unsigned int getWidth(void) const
78                { return this->width_; }
79               
80            /**
81            @brief Set the height of the playing field.
82            @param height The height in number of tiles.
83            */
84            void setHeight(unsigned int height)
85                { this->height_ = height; }
86            /**
87            @brief Get the height of the playing field.
88            @return Returns the height in number of tiles.
89            */
90            unsigned int getHeight(void) const
91                { return this->height_; }
92               
93            /**
94            @brief Set the template for the towers.
95            @param template The template name to be applied to each tower.
96            */
97            void setTowerTemplate(const std::string& templateName)
98                { this->towerTemplate_ = templateName; }
99            /**
100            @brief Get the template for the towers.
101            @return Returns the template name to be applied to each tower.
102            */
103            const std::string& getTowerTemplate(void) const
104                { return this->towerTemplate_; }
105           
106
107        private:
108            void checkGametype(); //!< Checks whether the gametype is TowerDefense and if it is, sets its centerpoint.
109           
110            unsigned int width_;
111            unsigned int height_;
112            std::string towerTemplate_;
113
114    };
115}
116
117#endif /* _TowerDefenseCenterpoint_H__ */
Note: See TracBrowser for help on using the repository browser.