Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc @ 12332

Last change on this file since 12332 was 12332, checked in by ahuwyler, 5 years ago

jetzt mehrere Bloecke

File size: 2.7 KB
RevLine 
[12278]1#include "OrxoBloxWall.h"
2#include "core/CoreIncludes.h"
3#include "core/XMLPort.h"
4
5#include "OrxoBlox.h"
[12331]6#include "OrxoBloxStones.h"
7#include "OrxoBloxCenterpoint.h"
8#include "util/Math.h"
[12278]9
10namespace orxonox
11{
12    RegisterClass(OrxoBloxWall);
13    /**
14    @brief
15        Constructor. Registers and initializes the object.
16    */
17    OrxoBloxWall::OrxoBloxWall(Context* context) : StaticEntity(context)
18    {
19        RegisterObject(OrxoBloxWall);
20
[12332]21        this->num_Stones_ = 2;//1 + static_cast<unsigned int>(rnd(6.0f)); //<! random number between 0 and 7;
22        this->size_ = 10.0f;
[12278]23        this->delay_ = false;
[12307]24        this->orxoblox_ = this->getOrxoBlox();
[12331]25        this->createWall();
26    }
[12307]27
28
[12331]29    void OrxoBloxWall::createWall(void){
[12332]30        orxout() <<"Hello idiot"<< endl;
[12331]31        for (unsigned int i=0; i<this->num_Stones_;++i){
[12332]32            orxout() <<i<< endl;
[12331]33            OrxoBloxStones* stone = new OrxoBloxStones(this->getContext());
34            this->TotalStones_.push_back(stone);
35            this->attach(stone);
[12332]36            stone->setPosition(size_*i, 0, 0.0f);
[12331]37
38
39
40            if(this->orxoblox_ != nullptr)
[12307]41            {
42                stone->setGame(this->orxoblox_);
43                if(this->orxoblox_->getCenterpoint() != nullptr)
44                    stone->addTemplate(this->orxoblox_->getCenterpoint()->getStoneTemplate());
45                else
46                    orxout()<< "tetris_->getCenterpoint == nullptr in TetrisBrick.cc"<< endl;
47            }
48            else
49                orxout()<< "tetris_ == nullptr in TetrisBrick.cc"<< endl;
[12331]50
51        }
52
53
54
55        // OrxoBloxStones* stone = new OrxoBloxStones(this->getContext());
56        // if(this->orxoblox_ != nullptr)
57        //     {
58        //         stone->setGame(this->orxoblox_);
59        //         if(this->orxoblox_->getCenterpoint() != nullptr)
60        //             stone->addTemplate(this->orxoblox_->getCenterpoint()->getStoneTemplate());
61        //         else
62        //             orxout()<< "orxoblox_->getCenterpoint == nullptr in TetrisBrick.cc"<< endl;
63        //     }
64        //     else
65        //         orxout()<< "orxoblox_ == nullptr in TetrisBrick.cc"<< endl;
[12278]66    }
[12307]67
[12331]68    OrxoBloxStones* OrxoBloxWall::getStone(unsigned int i)
69    {
70        if(i < this->TotalStones_.size())
71            return this->TotalStones_[i];
72        else return nullptr;
73    }
[12307]74
75    OrxoBlox* OrxoBloxWall::getOrxoBlox()
76    {
77        if (this->getGametype() != nullptr && this->getGametype()->isA(Class(OrxoBlox)))
78        {
79            OrxoBlox* orxobloxGametype = orxonox_cast<OrxoBlox*>(this->getGametype());
80            return orxobloxGametype;
81        }
[12308]82        else orxout()<<"There is no Gametype for OrxoBlox! ask Anna"<< endl;
[12307]83        return nullptr;
84    }
[12278]85}
Note: See TracBrowser for help on using the repository browser.