Rev | Line | |
---|
[12278] | 1 | #include "OrxoBloxWall.h" |
---|
| 2 | #include "core/CoreIncludes.h" |
---|
| 3 | #include "core/XMLPort.h" |
---|
| 4 | |
---|
| 5 | #include "OrxoBlox.h" |
---|
| 6 | |
---|
| 7 | namespace orxonox |
---|
| 8 | { |
---|
| 9 | RegisterClass(OrxoBloxWall); |
---|
| 10 | /** |
---|
| 11 | @brief |
---|
| 12 | Constructor. Registers and initializes the object. |
---|
| 13 | */ |
---|
| 14 | OrxoBloxWall::OrxoBloxWall(Context* context) : StaticEntity(context) |
---|
| 15 | { |
---|
| 16 | RegisterObject(OrxoBloxWall); |
---|
| 17 | |
---|
[12307] | 18 | this->health_ = 1 + static_cast<unsigned int>(rnd(6.0f)); //<! random number between 0 and 7; |
---|
[12278] | 19 | this->delay_ = false; |
---|
[12307] | 20 | this->orxoblox_ = this->getOrxoBlox(); |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | OrxoBloxStones* stone = new OrxoBloxStones(this->getContext()); |
---|
| 24 | if(this->orxoblox_ != nullptr) |
---|
| 25 | { |
---|
| 26 | stone->setGame(this->orxoblox_); |
---|
| 27 | if(this->orxoblox_->getCenterpoint() != nullptr) |
---|
| 28 | stone->addTemplate(this->orxoblox_->getCenterpoint()->getStoneTemplate()); |
---|
| 29 | else |
---|
| 30 | orxout()<< "tetris_->getCenterpoint == nullptr in TetrisBrick.cc"<< endl; |
---|
| 31 | } |
---|
| 32 | else |
---|
| 33 | orxout()<< "tetris_ == nullptr in TetrisBrick.cc"<< endl; |
---|
[12278] | 34 | } |
---|
[12307] | 35 | |
---|
| 36 | |
---|
| 37 | OrxoBlox* OrxoBloxWall::getOrxoBlox() |
---|
| 38 | { |
---|
| 39 | if (this->getGametype() != nullptr && this->getGametype()->isA(Class(OrxoBlox))) |
---|
| 40 | { |
---|
| 41 | OrxoBlox* orxobloxGametype = orxonox_cast<OrxoBlox*>(this->getGametype()); |
---|
| 42 | return orxobloxGametype; |
---|
| 43 | } |
---|
[12308] | 44 | else orxout()<<"There is no Gametype for OrxoBlox! ask Anna"<< endl; |
---|
[12307] | 45 | return nullptr; |
---|
| 46 | } |
---|
[12278] | 47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.