#include "OrxoBloxCenterpoint.h" #include "core/CoreIncludes.h" #include "core/XMLPort.h" #include "OrxoBlox.h" namespace orxonox { RegisterClass(OrxoBloxCenterpoint); /** @brief Constructor. Registers and initializes the object and checks whether the gametype is actually OrxoBlox. */ OrxoBloxCenterpoint::OrxoBloxCenterpoint(Context* context) : StaticEntity(context) { RegisterObject(OrxoBloxCenterpoint); this->width_ = 100; this->height_ = 50; this->ballspeed_ = 100; this->ballaccfactor_ = 1.0; this->checkGametype(); } /** @brief Method to create a OrxoBloxCenterpoint through XML. */ void OrxoBloxCenterpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode) { SUPER(OrxoBloxCenterpoint, XMLPort, xmlelement, mode); XMLPortParam(OrxoBloxCenterpoint, "dimension", setFieldDimension, getFieldDimension, xmlelement, mode); XMLPortParam(OrxoBloxCenterpoint, "balltemplate", setBalltemplate, getBalltemplate, xmlelement, mode); XMLPortParam(OrxoBloxCenterpoint, "ballspeed", setBallSpeed, getBallSpeed, xmlelement, mode); XMLPortParam(OrxoBloxCenterpoint, "ballaccfactor", setBallAccelerationFactor, getBallAccelerationFactor, xmlelement, mode); XMLPortParam(OrxoBloxCenterpoint, "stoneTemplate", setStoneTemplate, getStoneTemplate, xmlelement, mode); XMLPortParam(OrxoBloxCenterpoint, "WallTemplate", setWallTemplate, getWallTemplate, xmlelement, mode); } /** @brief Checks whether the gametype is OrxoBlox and if it is, sets its centerpoint. */ void OrxoBloxCenterpoint::checkGametype() { if (this->getGametype() != nullptr && this->getGametype()->isA(Class(OrxoBlox))) { OrxoBlox* OrxoBloxGametype = orxonox_cast(this->getGametype()); OrxoBloxGametype->setCenterpoint(this); } } }