- Timestamp:
- Oct 28, 2008, 3:05:17 AM (16 years ago)
- Location:
- code/branches/objecthierarchy/src/orxonox/objects/worldentities
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/objects/worldentities/ControllableEntity.h
r2019 r2024 57 57 { return this->bDestroyWhenPlayerLeft_; } 58 58 59 virtual void moveFrontBack( floatvalue) {}60 virtual void moveRightLeft( floatvalue) {}61 virtual void moveUpDown( floatvalue) {}59 virtual void moveFrontBack(const Vector2& value) {} 60 virtual void moveRightLeft(const Vector2& value) {} 61 virtual void moveUpDown(const Vector2& value) {} 62 62 63 virtual void rotateYaw( floatvalue) {}64 virtual void rotatePitch( floatvalue) {}65 virtual void rotateRoll( floatvalue) {}63 virtual void rotateYaw(const Vector2& value) {} 64 virtual void rotatePitch(const Vector2& value) {} 65 virtual void rotateRoll(const Vector2& value) {} 66 66 67 67 virtual void fire() {} … … 108 108 { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; } 109 109 110 inline Camera* getCamera() const 111 { return this->camera_; } 112 inline OverlayGroup* getHUD() const 113 { return this->hud_; } 114 110 115 protected: 111 116 virtual void startLocalControl(); … … 117 122 inline bool isLocallyControlled() const 118 123 { return this->bControlled_; } 124 125 Vector3 acceleration_; 119 126 120 127 private: … … 136 143 137 144 Vector3 velocity_; 138 Vector3 acceleration_;139 145 140 146 bool bControlled_; -
code/branches/objecthierarchy/src/orxonox/objects/worldentities/SpawnPoint.cc
r2019 r2024 57 57 58 58 XMLPortParam(SpawnPoint, "spawnclass", setSpawnClassName, getSpawnClassName, xmlelement, mode); 59 XMLPortParam(SpawnPoint, " design", setTemplateName, getTemplateName, xmlelement, mode);59 XMLPortParam(SpawnPoint, "pawndesign", setTemplateName, getTemplateName, xmlelement, mode); 60 60 } 61 61 … … 72 72 } 73 73 74 ControllableEntity* SpawnPoint::spawn()74 Pawn* SpawnPoint::spawn() 75 75 { 76 ControllableEntity* entity = this->spawnclass_.fabricate(this);76 Pawn* entity = this->spawnclass_.fabricate(this); 77 77 if (entity) 78 78 { 79 this->getGametype()->pawnPreSpawn(entity); 79 80 this->spawn(entity); 80 81 if (this->template_) 81 82 entity->addTemplate(this->template_); 83 entity->postSpawn(); 84 this->getGametype()->pawnPostSpawn(entity); 82 85 } 83 86 return entity; -
code/branches/objecthierarchy/src/orxonox/objects/worldentities/SpawnPoint.h
r2019 r2024 35 35 #include "core/Template.h" 36 36 #include "PositionableEntity.h" 37 #include " ControllableEntity.h"37 #include "objects/worldentities/pawns/Pawn.h" 38 38 39 39 namespace orxonox … … 57 57 { return this->template_; } 58 58 59 ControllableEntity* spawn();59 Pawn* spawn(); 60 60 void spawn(ControllableEntity* entity); 61 61 … … 69 69 { return this->templatename_; } 70 70 71 SubclassIdentifier< ControllableEntity> spawnclass_;71 SubclassIdentifier<Pawn> spawnclass_; 72 72 std::string spawnclassname_; 73 73 Template* template_; -
code/branches/objecthierarchy/src/orxonox/objects/worldentities/pawns/Spectator.cc
r2019 r2024 35 35 #include "objects/Scene.h" 36 36 #include "objects/infos/PlayerInfo.h" 37 #include "objects/gametypes/Gametype.h" 37 38 #include "tools/BillboardSet.h" 39 #include "overlays/OverlayText.h" 40 #include "overlays/OverlayGroup.h" 41 #include "util/Convert.h" 38 42 39 43 namespace orxonox … … 54 58 55 59 this->setDestroyWhenPlayerLeft(true); 56 57 // test test test58 if (this->getScene()->getSceneManager())59 {60 this->testmesh_ = new Mesh();61 this->testnode_ = this->getNode()->createChildSceneNode();62 this->testmesh_->setMeshSource(this->getScene()->getSceneManager(), "assff.mesh");63 if (this->testmesh_->getEntity())64 this->testnode_->attachObject(this->testmesh_->getEntity());65 this->testnode_->pitch(Degree(-90));66 this->testnode_->roll(Degree(+90));67 this->testnode_->scale(10, 10, 10);68 }69 else70 {71 this->testmesh_ = 0;72 this->testnode_ = 0;73 }74 // test test test75 60 76 61 this->greetingFlare_ = new BillboardSet(); … … 93 78 delete this->greetingFlare_; 94 79 } 95 96 // test test test97 {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());106 }107 // test test test108 80 } 109 81 } … … 130 102 if (this->isLocallyControlled()) 131 103 { 104 this->updateHUD(); 105 132 106 Vector3 velocity = this->getVelocity(); 133 107 velocity.normalise(); … … 159 133 { 160 134 ControllableEntity::startLocalControl(); 161 if (this->isLocallyControlled())162 this->testmesh_->setVisible(false);163 } 164 165 void Spectator::moveFrontBack( floatvalue)166 { 167 this->setVelocity(this->getVelocity() + value * this->speed_ * WorldEntity::FRONT);168 } 169 170 void Spectator::moveRightLeft( floatvalue)171 { 172 this->setVelocity(this->getVelocity() + value * this->speed_ * WorldEntity::RIGHT);173 } 174 175 void Spectator::moveUpDown( floatvalue)176 { 177 this->setVelocity(this->getVelocity() + value * this->speed_ * WorldEntity::UP);178 } 179 180 void Spectator::rotateYaw( floatvalue)181 { 182 this->yaw_ = value ;183 } 184 185 void Spectator::rotatePitch( floatvalue)186 { 187 this->pitch_ = value ;188 } 189 190 void Spectator::rotateRoll( floatvalue)191 { 192 this->roll_ = value ;135 // if (this->isLocallyControlled()) 136 // this->testmesh_->setVisible(false); 137 } 138 139 void Spectator::moveFrontBack(const Vector2& value) 140 { 141 this->setVelocity(this->getVelocity() + value.y * this->speed_ * WorldEntity::FRONT); 142 } 143 144 void Spectator::moveRightLeft(const Vector2& value) 145 { 146 this->setVelocity(this->getVelocity() + value.y * this->speed_ * WorldEntity::RIGHT); 147 } 148 149 void Spectator::moveUpDown(const Vector2& value) 150 { 151 this->setVelocity(this->getVelocity() + value.y * this->speed_ * WorldEntity::UP); 152 } 153 154 void Spectator::rotateYaw(const Vector2& value) 155 { 156 this->yaw_ = value.y; 157 } 158 159 void Spectator::rotatePitch(const Vector2& value) 160 { 161 this->pitch_ = value.y; 162 } 163 164 void Spectator::rotateRoll(const Vector2& value) 165 { 166 this->roll_ = value.y; 193 167 } 194 168 … … 209 183 } 210 184 } 185 186 void Spectator::updateHUD() 187 { 188 // <hack> 189 if (this->getHUD()) 190 { 191 std::string text; 192 193 if (this->getPlayer() && this->getGametype()) 194 { 195 if (!this->getGametype()->hasStarted() && !this->getGametype()->isStartCountdownRunning()) 196 { 197 if (!this->getPlayer()->isReadyToSpawn()) 198 text = "Press [Fire] to start the match"; 199 else 200 text = "Waiting for other players"; 201 } 202 else if (!this->getGametype()->hasEnded()) 203 { 204 if (this->getGametype()->isStartCountdownRunning()) 205 { 206 text = convertToString(ceil(this->getGametype()->getStartCountdown())); 207 } 208 else 209 { 210 text = "Press [Fire] to respawn"; 211 } 212 } 213 else 214 { 215 text = "Game has ended"; 216 } 217 } 218 else 219 { 220 return; 221 } 222 223 std::map<std::string, OrxonoxOverlay*>::const_iterator it = this->getHUD()->getOverlays().begin(); 224 for (; it != this->getHUD()->getOverlays().end(); ++it) 225 { 226 if (it->second->isA(Class(OverlayText)) && it->second->getName() == "state") 227 { 228 OverlayText* overlay = dynamic_cast<OverlayText*>(it->second); 229 if (overlay) 230 overlay->setCaption(text); 231 break; 232 } 233 } 234 } 235 // </hack> 236 } 211 237 } -
code/branches/objecthierarchy/src/orxonox/objects/worldentities/pawns/Spectator.h
r2019 r2024 48 48 virtual void startLocalControl(); 49 49 50 virtual void moveFrontBack( floatvalue);51 virtual void moveRightLeft( floatvalue);52 virtual void moveUpDown( floatvalue);50 virtual void moveFrontBack(const Vector2& value); 51 virtual void moveRightLeft(const Vector2& value); 52 virtual void moveUpDown(const Vector2& value); 53 53 54 virtual void rotateYaw( floatvalue);55 virtual void rotatePitch( floatvalue);56 virtual void rotateRoll( floatvalue);54 virtual void rotateYaw(const Vector2& value); 55 virtual void rotatePitch(const Vector2& value); 56 virtual void rotateRoll(const Vector2& value); 57 57 58 58 virtual void fire(); … … 62 62 void changedGreeting(); 63 63 void changedFlareVisibility(); 64 void updateHUD(); 64 65 65 66 BillboardSet* greetingFlare_; … … 73 74 float pitch_; 74 75 float roll_; 75 76 // test test test77 Mesh* testmesh_;78 Ogre::SceneNode* testnode_;79 // test test test80 76 }; 81 77 }
Note: See TracChangeset
for help on using the changeset viewer.