#ifndef _OrxoBloxCenterpoint_H__ #define _OrxoBloxCenterpoint_H__ #include "OrxoBlox/OrxoBloxPrereqs.h" #include #include #include "worldentities/StaticEntity.h" namespace orxonox { class _OrxoBloxExport OrxoBloxCenterpoint : public StaticEntity { public: OrxoBloxCenterpoint(Context* context); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually OrxoBlox. virtual ~OrxoBloxCenterpoint() {} virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method to create a OrxoBloxCenterpoint through XML. /** @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.) @param balltemplate The name of the template to be set. */ void setBalltemplate(const std::string& balltemplate) { this->balltemplate_ = balltemplate; } /** @brief Get the template of the ball. @return Returns the name of the template of the ball. */ const std::string& getBalltemplate() const { return this->balltemplate_; } /** @brief Set the dimensions of the playing field. @param dimension A vector with the width of the playing field as first component and the height as second. */ void setFieldDimension(const Vector2& dimension) { this->width_ = dimension.x; this->height_ = dimension.y; } /** @brief Get the dimensions of the playing field. @return Returns a vector with the width of the playing field as first component and the height as second. */ Vector2 getFieldDimension() const { return Vector2(this->width_, this->height_); } /** @brief Set the speed of the ball. @param ballspeed The speed of the ball. */ void setBallSpeed(float ballspeed) { this->ballspeed_ = ballspeed; } /** @brief Get the speed of the ball. @return Returns the speed of the ball. */ float getBallSpeed() const { return this->ballspeed_; } /** @brief Set the ball's acceleration factor. @param ballaccfactor The ball's acceleration factor. */ void setBallAccelerationFactor(float ballaccfactor) { this->ballaccfactor_ = ballaccfactor; } /** @brief Get the ball's acceleration factor @return Returns the ball's acceleration factor. */ float getBallAccelerationFactor() const { return this->ballaccfactor_; } /** @brief Set the template for the stones. @param templateName The template name to be applied to each stone. */ void setStoneTemplate(const std::string& templateName) { this->stoneTemplate_ = templateName; } /** @brief Get the template for the stones. @return Returns the template name to be applied to each stone. */ const std::string& getStoneTemplate(void) const { return this->stoneTemplate_; } /** @brief Set the template for the bricks. @param templateName The template name to be applied to each brick. */ void setWallTemplate(const std::string& templateName) { this->WallTemplate_ = templateName; } /** @brief Get the template for the bricks. @return Returns the template name to be applied to each brick. */ const std::string& getWallTemplate(void) const { return this->WallTemplate_; } private: void checkGametype(); //!< Checks whether the gametype is OrxoBlox and if it is, sets its centerpoint. std::string balltemplate_; //!< The template for the ball. std::string WallTemplate_; std::string stoneTemplate_; float ballspeed_; //!< The speed of then ball. float ballaccfactor_; //!< The acceleration factor of the ball. float width_; //!< The height of the playing field. float height_; //!< The width of the playing field. }; } #endif /* _OrxoBloxCenterpoint_H__ */