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/controllers
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/objects/controllers/Controller.cc

    r1993 r2019  
    3636    CreateUnloadableFactory(Controller);
    3737
    38     Controller::Controller()
     38    Controller::Controller(BaseObject* creator) : BaseObject(creator)
    3939    {
    4040        RegisterObject(Controller);
    4141
    4242        this->player_ = 0;
    43         this->pawn_ = 0;
     43        this->controllableEntity_ = 0;
    4444    }
    4545
  • code/branches/objecthierarchy/src/orxonox/objects/controllers/Controller.h

    r1993 r2019  
    3939    {
    4040        public:
    41             Controller();
     41            Controller(BaseObject* creator);
    4242            virtual ~Controller();
    4343
     
    4747                { return this->player_; }
    4848
    49             inline void setPawn(ControllableEntity* pawn)
    50                 { this->pawn_ = pawn; }
    51             inline ControllableEntity* getPawn() const
    52                 { return this->pawn_; }
     49            virtual inline void setControllableEntity(ControllableEntity* entity)
     50                { this->controllableEntity_ = entity; }
     51            virtual inline ControllableEntity* getControllableEntity() const
     52                { return this->controllableEntity_; }
    5353
    5454        protected:
    5555            PlayerInfo* player_;
    56             ControllableEntity* pawn_;
     56            ControllableEntity* controllableEntity_;
    5757    };
    5858}
  • code/branches/objecthierarchy/src/orxonox/objects/controllers/HumanController.cc

    r2001 r2019  
    5252    HumanController* HumanController::localController_s = 0;
    5353
    54     HumanController::HumanController()
     54    HumanController::HumanController(BaseObject* creator) : Controller(creator)
    5555    {
    5656        RegisterObject(HumanController);
     
    6666    void HumanController::moveFrontBack(const Vector2& value)
    6767    {
    68         if (HumanController::localController_s && HumanController::localController_s->pawn_)
    69             HumanController::localController_s->pawn_->moveFrontBack(value.y);
     68        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     69            HumanController::localController_s->controllableEntity_->moveFrontBack(value.y);
    7070    }
    7171
    7272    void HumanController::moveRightLeft(const Vector2& value)
    7373    {
    74         if (HumanController::localController_s && HumanController::localController_s->pawn_)
    75             HumanController::localController_s->pawn_->moveRightLeft(value.y);
     74        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     75            HumanController::localController_s->controllableEntity_->moveRightLeft(value.y);
    7676    }
    7777
    7878    void HumanController::moveUpDown(const Vector2& value)
    7979    {
    80         if (HumanController::localController_s && HumanController::localController_s->pawn_)
    81             HumanController::localController_s->pawn_->moveUpDown(value.y);
     80        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     81            HumanController::localController_s->controllableEntity_->moveUpDown(value.y);
    8282    }
    8383
    8484    void HumanController::rotateYaw(const Vector2& value)
    8585    {
    86         if (HumanController::localController_s && HumanController::localController_s->pawn_)
    87             HumanController::localController_s->pawn_->rotateYaw(value.y);
     86        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     87            HumanController::localController_s->controllableEntity_->rotateYaw(value.y);
    8888    }
    8989
    9090    void HumanController::rotatePitch(const Vector2& value)
    9191    {
    92         if (HumanController::localController_s && HumanController::localController_s->pawn_)
    93             HumanController::localController_s->pawn_->rotatePitch(value.y);
     92        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     93            HumanController::localController_s->controllableEntity_->rotatePitch(value.y);
    9494    }
    9595
    9696    void HumanController::rotateRoll(const Vector2& value)
    9797    {
    98         if (HumanController::localController_s && HumanController::localController_s->pawn_)
    99             HumanController::localController_s->pawn_->rotateRoll(value.y);
     98        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     99            HumanController::localController_s->controllableEntity_->rotateRoll(value.y);
    100100    }
    101101
    102102    void HumanController::fire()
    103103    {
    104         if (HumanController::localController_s && HumanController::localController_s->pawn_)
    105             HumanController::localController_s->pawn_->fire();
     104        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     105            HumanController::localController_s->controllableEntity_->fire();
    106106    }
    107107
    108108    void HumanController::altFire()
    109109    {
    110         if (HumanController::localController_s && HumanController::localController_s->pawn_)
    111             HumanController::localController_s->pawn_->altFire();
     110        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     111            HumanController::localController_s->controllableEntity_->altFire();
    112112    }
    113113
    114114    void HumanController::greet()
    115115    {
    116         if (HumanController::localController_s && HumanController::localController_s->pawn_)
    117             HumanController::localController_s->pawn_->greet();
     116        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     117            HumanController::localController_s->controllableEntity_->greet();
    118118    }
    119119
    120120    void HumanController::use()
    121121    {
    122         if (HumanController::localController_s && HumanController::localController_s->pawn_)
    123             HumanController::localController_s->pawn_->use();
     122        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     123            HumanController::localController_s->controllableEntity_->use();
    124124    }
    125125
    126126    void HumanController::switchCamera()
    127127    {
    128         if (HumanController::localController_s && HumanController::localController_s->pawn_)
    129             HumanController::localController_s->pawn_->switchCamera();
     128        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     129            HumanController::localController_s->controllableEntity_->switchCamera();
    130130    }
    131131}
  • code/branches/objecthierarchy/src/orxonox/objects/controllers/HumanController.h

    r2001 r2019  
    4040    {
    4141        public:
    42             HumanController();
     42            HumanController(BaseObject* creator);
    4343            virtual ~HumanController();
    4444
Note: See TracChangeset for help on using the changeset viewer.