Changeset 11518 for code/branches/ScriptableController_HS17/src/orxonox
- Timestamp:
- Oct 30, 2017, 4:05:01 PM (7 years ago)
- Location:
- code/branches/ScriptableController_HS17/src/orxonox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ScriptableController_HS17/src/orxonox/CMakeLists.txt
r11356 r11518 52 52 ADD_SUBDIRECTORY(items) 53 53 ADD_SUBDIRECTORY(overlays) 54 ADD_SUBDIRECTORY(scriptablecontroller) 54 55 ADD_SUBDIRECTORY(sound) 55 56 ADD_SUBDIRECTORY(weaponsystem) -
code/branches/ScriptableController_HS17/src/orxonox/Level.cc
r11071 r11518 42 42 #include "overlays/OverlayGroup.h" 43 43 #include "LevelManager.h" 44 #include "scriptablecontroller/scriptable_controller.h" 44 45 45 46 namespace orxonox … … 79 80 XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype"); 80 81 82 XMLPortParamLoadOnly(Level, "script", setScript, xmlelement, mode); 83 81 84 XMLPortObject(Level, MeshLodInformation, "lodinformation", addLodInfo, getLodInfo, xmlelement, mode); 82 85 XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false); 86 87 if(this->level_script_ != "") 88 { 89 this->controller_.reset(new ScriptableController()); 90 this->controller_->runScript(this->level_script_); 91 } 83 92 } 84 93 … … 168 177 { 169 178 this->objects_.push_back(object); 179 if(this->controller_.get() != nullptr) 180 object->registerToScriptableController(this->controller_.get()); 170 181 } 171 182 -
code/branches/ScriptableController_HS17/src/orxonox/Level.h
r11071 r11518 42 42 namespace orxonox 43 43 { 44 class ScriptableController; 45 44 46 class _OrxonoxExport Level : public BaseObject, public Synchronisable, public Context 45 47 { … … 78 80 void networkcallback_applyXMLFile(); 79 81 82 inline void setScript(const std::string &script) 83 { this->level_script_ = script; } 84 85 80 86 std::string pluginsString_; 81 87 std::list<PluginReference*> plugins_; 82 83 88 std::string gametype_; 84 89 std::string xmlfilename_; … … 86 91 std::list<BaseObject*> objects_; 87 92 std::map<std::string,MeshLodInformation*> lodInformation_; 93 94 std::unique_ptr<ScriptableController> controller_; 95 std::string level_script_; 88 96 }; 89 97 } -
code/branches/ScriptableController_HS17/src/orxonox/worldentities/ControllableEntity.cc
r11071 r11518 44 44 #include "worldentities/CameraPosition.h" 45 45 #include "overlays/OverlayGroup.h" 46 #include "scriptablecontroller/scriptable_controller.h" 46 47 47 48 namespace orxonox … … 337 338 } 338 339 340 void ControllableEntity::registerToScriptableController(ScriptableController *controller) 341 { 342 controller->registerControllableEntity(this->id_, this); 343 } 344 339 345 void ControllableEntity::setPlayer(PlayerInfo* player) 340 346 { -
code/branches/ScriptableController_HS17/src/orxonox/worldentities/ControllableEntity.h
r11071 r11518 175 175 inline int getTeam() const 176 176 { return this->team_; } 177 178 virtual void registerToScriptableController(ScriptableController *controller) override; 177 179 178 180 protected: -
code/branches/ScriptableController_HS17/src/orxonox/worldentities/WorldEntity.cc
r11083 r11518 45 45 #include "Scene.h" 46 46 #include "collisionshapes/WorldEntityCollisionShape.h" 47 #include "scriptablecontroller/scriptable_controller.h" 47 48 48 49 namespace orxonox … … 79 80 this->parentID_ = OBJECTID_UNKNOWN; 80 81 this->bDeleteWithParent_ = true; 82 this->id_ = -1; 81 83 82 84 this->node_->setPosition(Vector3::ZERO); … … 160 162 XMLPortParamTemplate(WorldEntity, "scale3D", setScale3D, getScale3D, xmlelement, mode, const Vector3&); 161 163 XMLPortParam (WorldEntity, "scale", setScale, getScale, xmlelement, mode); 164 XMLPortParamLoadOnly(WorldEntity, "id", setID, xmlelement, mode); 162 165 XMLPortParamLoadOnly(WorldEntity, "lookat", lookAt_xmlport, xmlelement, mode); 163 166 XMLPortParamLoadOnly(WorldEntity, "direction", setDirection_xmlport, xmlelement, mode); … … 275 278 } 276 279 280 void WorldEntity::registerToScriptableController(ScriptableController *controller) 281 { 282 controller->registerWorldEntity(this->id_, this); 283 } 284 277 285 /** 278 286 @brief -
code/branches/ScriptableController_HS17/src/orxonox/worldentities/WorldEntity.h
r11099 r11518 110 110 virtual void changedActivity(void) override; 111 111 virtual void changedVisibility(void) override; 112 113 inline void setID(int id) 114 { this->id_ = id; } 115 116 virtual void registerToScriptableController(ScriptableController *controller) override; 112 117 113 118 virtual void setPosition(const Vector3& position) = 0; … … 442 447 443 448 btRigidBody* physicalBody_; //!< Bullet rigid body. Everything physical is applied to this instance. 449 int id_; //!< Used by the ScriptableController to identify objects 444 450 445 451 private:
Note: See TracChangeset
for help on using the changeset viewer.