- Timestamp:
- Oct 27, 2008, 4:08:51 AM (16 years ago)
- 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 36 36 CreateUnloadableFactory(Controller); 37 37 38 Controller::Controller( )38 Controller::Controller(BaseObject* creator) : BaseObject(creator) 39 39 { 40 40 RegisterObject(Controller); 41 41 42 42 this->player_ = 0; 43 this-> pawn_ = 0;43 this->controllableEntity_ = 0; 44 44 } 45 45 -
code/branches/objecthierarchy/src/orxonox/objects/controllers/Controller.h
r1993 r2019 39 39 { 40 40 public: 41 Controller( );41 Controller(BaseObject* creator); 42 42 virtual ~Controller(); 43 43 … … 47 47 { return this->player_; } 48 48 49 inline void setPawn(ControllableEntity* pawn)50 { this-> pawn_ = pawn; }51 inline ControllableEntity* getPawn() const52 { return this-> pawn_; }49 virtual inline void setControllableEntity(ControllableEntity* entity) 50 { this->controllableEntity_ = entity; } 51 virtual inline ControllableEntity* getControllableEntity() const 52 { return this->controllableEntity_; } 53 53 54 54 protected: 55 55 PlayerInfo* player_; 56 ControllableEntity* pawn_;56 ControllableEntity* controllableEntity_; 57 57 }; 58 58 } -
code/branches/objecthierarchy/src/orxonox/objects/controllers/HumanController.cc
r2001 r2019 52 52 HumanController* HumanController::localController_s = 0; 53 53 54 HumanController::HumanController( )54 HumanController::HumanController(BaseObject* creator) : Controller(creator) 55 55 { 56 56 RegisterObject(HumanController); … … 66 66 void HumanController::moveFrontBack(const Vector2& value) 67 67 { 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); 70 70 } 71 71 72 72 void HumanController::moveRightLeft(const Vector2& value) 73 73 { 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); 76 76 } 77 77 78 78 void HumanController::moveUpDown(const Vector2& value) 79 79 { 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); 82 82 } 83 83 84 84 void HumanController::rotateYaw(const Vector2& value) 85 85 { 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); 88 88 } 89 89 90 90 void HumanController::rotatePitch(const Vector2& value) 91 91 { 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); 94 94 } 95 95 96 96 void HumanController::rotateRoll(const Vector2& value) 97 97 { 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); 100 100 } 101 101 102 102 void HumanController::fire() 103 103 { 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(); 106 106 } 107 107 108 108 void HumanController::altFire() 109 109 { 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(); 112 112 } 113 113 114 114 void HumanController::greet() 115 115 { 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(); 118 118 } 119 119 120 120 void HumanController::use() 121 121 { 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(); 124 124 } 125 125 126 126 void HumanController::switchCamera() 127 127 { 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(); 130 130 } 131 131 } -
code/branches/objecthierarchy/src/orxonox/objects/controllers/HumanController.h
r2001 r2019 40 40 { 41 41 public: 42 HumanController( );42 HumanController(BaseObject* creator); 43 43 virtual ~HumanController(); 44 44
Note: See TracChangeset
for help on using the changeset viewer.