#include "OrxoBloxWall.h" #include "core/CoreIncludes.h" #include "core/XMLPort.h" #include "OrxoBlox.h" #include "OrxoBloxStones.h" #include "OrxoBloxCenterpoint.h" #include "util/Math.h" namespace orxonox { RegisterClass(OrxoBloxWall); /** @brief Constructor. Registers and initializes the object. */ OrxoBloxWall::OrxoBloxWall(Context* context) : StaticEntity(context) { RegisterObject(OrxoBloxWall); this->num_Stones_ = 2;//1 + static_cast(rnd(6.0f)); //size_ = 10.0f; this->delay_ = false; this->orxoblox_ = this->getOrxoBlox(); this->createWall(); } void OrxoBloxWall::createWall(void){ orxout() <<"Hello idiot"<< endl; for (unsigned int i=0; inum_Stones_;++i){ orxout() <getContext()); this->TotalStones_.push_back(stone); this->attach(stone); stone->setPosition(size_*i, 0, 0.0f); if(this->orxoblox_ != nullptr) { stone->setGame(this->orxoblox_); if(this->orxoblox_->getCenterpoint() != nullptr) stone->addTemplate(this->orxoblox_->getCenterpoint()->getStoneTemplate()); else orxout()<< "tetris_->getCenterpoint == nullptr in TetrisBrick.cc"<< endl; } else orxout()<< "tetris_ == nullptr in TetrisBrick.cc"<< endl; } // OrxoBloxStones* stone = new OrxoBloxStones(this->getContext()); // if(this->orxoblox_ != nullptr) // { // stone->setGame(this->orxoblox_); // if(this->orxoblox_->getCenterpoint() != nullptr) // stone->addTemplate(this->orxoblox_->getCenterpoint()->getStoneTemplate()); // else // orxout()<< "orxoblox_->getCenterpoint == nullptr in TetrisBrick.cc"<< endl; // } // else // orxout()<< "orxoblox_ == nullptr in TetrisBrick.cc"<< endl; } OrxoBloxStones* OrxoBloxWall::getStone(unsigned int i) { if(i < this->TotalStones_.size()) return this->TotalStones_[i]; else return nullptr; } OrxoBlox* OrxoBloxWall::getOrxoBlox() { if (this->getGametype() != nullptr && this->getGametype()->isA(Class(OrxoBlox))) { OrxoBlox* orxobloxGametype = orxonox_cast(this->getGametype()); return orxobloxGametype; } else orxout()<<"There is no Gametype for OrxoBlox! ask Anna"<< endl; return nullptr; } }