1 | #ifndef _OrxoBloxCenterpoint_H__ |
---|
2 | #define _OrxoBloxCenterpoint_H__ |
---|
3 | |
---|
4 | #include "OrxoBlox/OrxoBloxPrereqs.h" |
---|
5 | |
---|
6 | #include <string> |
---|
7 | |
---|
8 | #include <util/Math.h> |
---|
9 | |
---|
10 | #include "worldentities/StaticEntity.h" |
---|
11 | |
---|
12 | namespace orxonox |
---|
13 | { |
---|
14 | |
---|
15 | class _OrxoBloxExport OrxoBloxCenterpoint : public StaticEntity |
---|
16 | { |
---|
17 | public: |
---|
18 | OrxoBloxCenterpoint(Context* context); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually OrxoBlox. |
---|
19 | virtual ~OrxoBloxCenterpoint() {} |
---|
20 | |
---|
21 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method to create a OrxoBloxCenterpoint through XML. |
---|
22 | |
---|
23 | /** |
---|
24 | @brief Set the template for the ball. (e.g. to attach the model of the ball, but also to attach an EventListener to it to detect, when it hits the boundaries, and e.g. display some ParticleEffets, when it does.) |
---|
25 | @param balltemplate The name of the template to be set. |
---|
26 | */ |
---|
27 | void setBalltemplate(const std::string& balltemplate) |
---|
28 | { this->balltemplate_ = balltemplate; } |
---|
29 | /** |
---|
30 | @brief Get the template of the ball. |
---|
31 | @return Returns the name of the template of the ball. |
---|
32 | */ |
---|
33 | const std::string& getBalltemplate() const |
---|
34 | { return this->balltemplate_; } |
---|
35 | |
---|
36 | |
---|
37 | /** |
---|
38 | @brief Set the dimensions of the playing field. |
---|
39 | @param dimension A vector with the width of the playing field as first component and the height as second. |
---|
40 | */ |
---|
41 | void setFieldDimension(const Vector2& dimension) |
---|
42 | { this->width_ = dimension.x; this->height_ = dimension.y; } |
---|
43 | /** |
---|
44 | @brief Get the dimensions of the playing field. |
---|
45 | @return Returns a vector with the width of the playing field as first component and the height as second. |
---|
46 | */ |
---|
47 | Vector2 getFieldDimension() const |
---|
48 | { return Vector2(this->width_, this->height_); } |
---|
49 | |
---|
50 | /** |
---|
51 | @brief Set the speed of the ball. |
---|
52 | @param ballspeed The speed of the ball. |
---|
53 | */ |
---|
54 | void setBallSpeed(float ballspeed) |
---|
55 | { this->ballspeed_ = ballspeed; } |
---|
56 | /** |
---|
57 | @brief Get the speed of the ball. |
---|
58 | @return Returns the speed of the ball. |
---|
59 | */ |
---|
60 | float getBallSpeed() const |
---|
61 | { return this->ballspeed_; } |
---|
62 | |
---|
63 | /** |
---|
64 | @brief Set the ball's acceleration factor. |
---|
65 | @param ballaccfactor The ball's acceleration factor. |
---|
66 | */ |
---|
67 | void setBallAccelerationFactor(float ballaccfactor) |
---|
68 | { this->ballaccfactor_ = ballaccfactor; } |
---|
69 | /** |
---|
70 | @brief Get the ball's acceleration factor |
---|
71 | @return Returns the ball's acceleration factor. |
---|
72 | */ |
---|
73 | float getBallAccelerationFactor() const |
---|
74 | { return this->ballaccfactor_; } |
---|
75 | |
---|
76 | |
---|
77 | /** |
---|
78 | @brief Set the template for the stones. |
---|
79 | @param templateName The template name to be applied to each stone. |
---|
80 | */ |
---|
81 | void setStoneTemplate(const std::string& templateName) |
---|
82 | { this->stoneTemplate_ = templateName; } |
---|
83 | /** |
---|
84 | @brief Get the template for the stones. |
---|
85 | @return Returns the template name to be applied to each stone. |
---|
86 | */ |
---|
87 | const std::string& getStoneTemplate(void) const |
---|
88 | { return this->stoneTemplate_; } |
---|
89 | |
---|
90 | |
---|
91 | /** |
---|
92 | @brief Set the template for the bricks. |
---|
93 | @param templateName The template name to be applied to each brick. |
---|
94 | */ |
---|
95 | void setWallTemplate(const std::string& templateName) |
---|
96 | { this->WallTemplate_ = templateName; } |
---|
97 | |
---|
98 | /** |
---|
99 | @brief Get the template for the bricks. |
---|
100 | @return Returns the template name to be applied to each brick. |
---|
101 | */ |
---|
102 | const std::string& getWallTemplate(void) const |
---|
103 | { return this->WallTemplate_; } |
---|
104 | |
---|
105 | |
---|
106 | private: |
---|
107 | void checkGametype(); //!< Checks whether the gametype is OrxoBlox and if it is, sets its centerpoint. |
---|
108 | |
---|
109 | std::string balltemplate_; //!< The template for the ball. |
---|
110 | std::string WallTemplate_; |
---|
111 | std::string stoneTemplate_; |
---|
112 | |
---|
113 | float ballspeed_; //!< The speed of then ball. |
---|
114 | float ballaccfactor_; //!< The acceleration factor of the ball. |
---|
115 | float width_; //!< The height of the playing field. |
---|
116 | float height_; //!< The width of the playing field. |
---|
117 | |
---|
118 | |
---|
119 | }; |
---|
120 | } |
---|
121 | |
---|
122 | #endif /* _OrxoBloxCenterpoint_H__ */ |
---|