Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 27, 2008, 4:08:51 AM (16 years ago)
Author:
landauf
Message:

many changes, most important: BaseObject takes now a pointer to it's creator which is needed to build a level hierarchy (with different scenes)

Location:
code/branches/objecthierarchy/src/orxonox/objects/worldentities/pawns
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/pawns/Spectator.cc

    r2006 r2019  
    3333#include "core/Core.h"
    3434#include "objects/worldentities/Model.h"
     35#include "objects/Scene.h"
     36#include "objects/infos/PlayerInfo.h"
    3537#include "tools/BillboardSet.h"
    3638
     
    3941    CreateFactory(Spectator);
    4042
    41     Spectator::Spectator()
     43    Spectator::Spectator(BaseObject* creator) : ControllableEntity(creator)
    4244    {
    4345        RegisterObject(Spectator);
     
    5456
    5557        // test test test
     58        if (this->getScene()->getSceneManager())
    5659        {
    5760            this->testmesh_ = new Mesh();
    5861            this->testnode_ = this->getNode()->createChildSceneNode();
    59             this->testmesh_->setMeshSource("assff.mesh");
     62            this->testmesh_->setMeshSource(this->getScene()->getSceneManager(), "assff.mesh");
    6063            if (this->testmesh_->getEntity())
    6164                this->testnode_->attachObject(this->testmesh_->getEntity());
     
    6467            this->testnode_->scale(10, 10, 10);
    6568        }
     69        else
     70        {
     71            this->testmesh_ = 0;
     72            this->testnode_ = 0;
     73        }
    6674        // test test test
    6775
    6876        this->greetingFlare_ = new BillboardSet();
    69         this->greetingFlare_->setBillboardSet("Examples/Flare", ColourValue(1.0, 1.0, 0.8), Vector3(0, 20, 0), 1);
     77        this->greetingFlare_->setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 1.0, 0.8), Vector3(0, 20, 0), 1);
    7078        this->getNode()->attachObject(this->greetingFlare_->getBillboardSet());
    7179        this->greetingFlare_->setVisible(false);
     
    8088        if (this->isInitialized())
    8189        {
    82             delete this->greetingFlare_;
     90            if (this->greetingFlare_)
     91            {
     92                this->getNode()->detachObject(this->greetingFlare_->getBillboardSet());
     93                delete this->greetingFlare_;
     94            }
    8395
    8496            // test test test
    8597            {
    86                 delete this->testmesh_;
    87                 delete this->testnode_;
     98                if (this->testmesh_ && this->testnode_)
     99                    this->testnode_->detachObject(this->testmesh_->getEntity());
     100
     101                if (this->testmesh_)
     102                    delete this->testmesh_;
     103
     104                if (this->testnode_)
     105                    this->getNode()->removeAndDestroyChild(this->testnode_->getName());
    88106            }
    89107            // test test test
     
    177195    void Spectator::fire()
    178196    {
     197        if (this->getPlayer())
     198            this->getPlayer()->setReadyToSpawn(true);
    179199    }
    180200
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/pawns/Spectator.h

    r2006 r2019  
    3939    {
    4040        public:
    41             Spectator();
     41            Spectator(BaseObject* creator);
    4242            virtual ~Spectator();
    4343
Note: See TracChangeset for help on using the changeset viewer.