Changeset 9047 in orxonox.OLD for branches/single_player_map/src
- Timestamp:
- Jul 3, 2006, 4:19:47 PM (18 years ago)
- Location:
- branches/single_player_map/src/world_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/world_entities/playable.cc
r9008 r9047 63 63 this->score = 0; 64 64 this->collider = NULL; 65 this->enterRadius = 10.0f; 65 66 66 67 this->bDead = false; -
branches/single_player_map/src/world_entities/playable.h
r9031 r9047 75 75 inline int getScore() { return this->score; } 76 76 77 void setEnterRadius(float radius) { this->enterRadius = radius; }; 78 /** @returns the EnterRadius (how far away a Player must be to enter this entity) */ 79 inline float getEnterRadius() const { return this->enterRadius; }; 77 80 78 81 // WorldEntity Extensions … … 117 120 Playable::Playmode playmode; //!< The current playmode. 118 121 122 float enterRadius; //!< How far one can be away from the Playable to enter it. 123 119 124 WorldEntity* collider; 120 125 }; -
branches/single_player_map/src/world_entities/player.cc
r8362 r9047 32 32 Player::Player() 33 33 { 34 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));34 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 35 35 this->setClassID(CL_PLAYER, "Player"); 36 36 … … 74 74 { 75 75 PRINTF(4)("Enter new Playable\n"); 76 77 78 76 this->playable = playable; 77 this->hud.setEnergyWidget(this->playable->getHealthWidget()); 78 this->hud.setWeaponManager(&this->playable->getWeaponManager()); 79 79 80 81 80 this->playable->setPlayer(this); 81 return true; 82 82 } 83 83 … … 89 89 90 90 bool Player::eject() 91 92 93 91 { 92 return this->setPlayable(NULL); 93 } 94 94 95 95 96 97 98 99 96 void Player::weaponConfigChanged() 97 { 98 this->hud.updateWeaponManager(); 99 } 100 100 101 void Player::process(const Event &event) 102 { 103 if (event.type == KeyMapper::PEV_CHANGE_SHIP && event.bPressed) 104 { 105 /// FIXME this should be in the ObjectManager 106 const std::list<BaseObject*>* objectList = ClassList::getList(CL_PLAYABLE); 107 if (objectList != NULL) 108 { 109 std::list<BaseObject*>::const_iterator node; 110 for (node = objectList->begin(); node != objectList->end(); node++) 111 if (this->playable != (*node) && (dynamic_cast<PNode*>(*node)->getAbsCoor() - this->playable->getAbsCoor()).len() < 10.0) 112 { 101 void Player::enterNewPlayable() 102 { 103 /// FIXME this should be in the ObjectManager 104 const std::list<BaseObject*>* objectList = ClassList::getList(CL_PLAYABLE); 105 if (objectList != NULL) 106 { 107 std::list<BaseObject*>::const_iterator node; 108 for (node = objectList->begin(); node != objectList->end(); node++) 109 if (this->playable != (*node) && 110 (dynamic_cast<PNode*>(*node)->getAbsCoor() - this->playable->getAbsCoor()).len() < (dynamic_cast<Playable*>(*node)->getEnterRadius())) 111 { 113 112 114 113 this->setPlayable(dynamic_cast<Playable*>(*node)); 115 114 116 117 118 119 115 break; 116 } 117 } 118 } 120 119 121 if (likely(this->playable != NULL))122 this->playable->process(event);123 }124 120 121 void Player::process(const Event &event) 122 { 123 if (event.type == KeyMapper::PEV_CHANGE_SHIP && event.bPressed) 124 { 125 this->enterNewPlayable(); 126 } 127 128 if (likely(this->playable != NULL)) 129 this->playable->process(event); 130 } 131 -
branches/single_player_map/src/world_entities/player.h
r9002 r9047 37 37 38 38 void weaponConfigChanged(); 39 void enterNewPlayable(); 39 40 40 41 // eventListener extension. -
branches/single_player_map/src/world_entities/space_ships/spacecraft_2d.cc
r9046 r9047 89 89 this->getWeaponManager().changeWeaponConfig(1); 90 90 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 91 92 this->loadModel("models/ships/hoverglider_mainbody.obj");93 91 } 94 92
Note: See TracChangeset
for help on using the changeset viewer.