Changeset 11287 for code/branches/QuestGuide_HS16
- Timestamp:
- Nov 14, 2016, 3:57:03 PM (8 years ago)
- Location:
- code/branches/QuestGuide_HS16/src/modules/waypoints
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/QuestGuide_HS16/src/modules/waypoints/CMakeLists.txt
r11274 r11287 1 ADD_SOURCE_FILES( ORXONOX_SRC_FILES1 ADD_SOURCE_FILES(WAYPOINTS_SRC_FILES 2 2 3 3 Waypointarrow.cc … … 6 6 ) 7 7 8 9 ORXONOX_ADD_LIBRARY(waypoints 10 MODULE 11 FIND_HEADER_FILES 12 LINK_LIBRARIES 13 orxonox 14 overlays 15 objects 16 SOURCE_FILES ${WAYPOINTS_SRC_FILES} 17 ) -
code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.cc
r11274 r11287 5 5 #include "util/OrxAssert.h" 6 6 #include "core/CoreIncludes.h" 7 #include "core/XMLPort.h" 8 7 9 8 10 namespace orxonox 11 12 9 13 { 10 14 RegisterClass(Waypoint); … … 37 41 void Waypoint::XMLPort(Element& xmlelement, XMLPort::Mode mode){ 38 42 SUPER(Waypoint, XMLPort, xmlelement, mode); // From the SpaceShip.cc file 39 XMLPortParam(Waypoint, "order", getOrder, setOrder, xmlelement, mode); 43 44 XMLPortParam(Waypoint, "order", setOrder, getOrder, xmlelement, mode); 40 45 41 46 } -
code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h
r11274 r11287 5 5 6 6 #include "OrxonoxPrereqs.h" 7 #include " StaticEntity.h"7 #include "worldentities/StaticEntity.h" 8 8 #include "graphics/Model.h" 9 #include " modules/objects/triggers/DistanceTrigger.h"9 #include "objects/triggers/DistanceTrigger.h" 10 10 11 11 #include <map> … … 43 43 } 44 44 45 inline void setOrder(int number){ 46 this->order = number; 47 } 45 48 46 49 inline int getOrder(){ 47 return order;50 return this->order; 48 51 } 49 52 -
code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc
r11274 r11287 4 4 #include <BulletDynamics/Dynamics/btRigidBody.h> 5 5 #include "util/OrxAssert.h" 6 #include "WaypointGroup.h" 6 7 #include "core/CoreIncludes.h" 8 #include "core/XMLPort.h" 9 7 10 8 11 namespace orxonox … … 12 15 WaypointGroup::WaypointGroup(Context* context) : StaticEntity(context) 13 16 { 14 /*RegisterObject(Waypoint);15 model = new Model(this->getContext());16 model->setMeshSource("cube.mesh"); // Name of the arrow file for now bottle17 this->attach(model);18 model->setScale(3);17 RegisterObject(WaypointGroup); 18 //model = new Model(this->getContext()); 19 //model->setMeshSource("cube.mesh"); // Name of the arrow file for now bottle 20 //is->attach(model); 21 //model->setScale(3); 19 22 //model->setOrientation(Vector3(0,0,-1)); 20 model->setPosition(Vector3(0.0,0.0,0.0)); // this is wrong, it has to be triggered21 waypoint_active = false;22 distancetrigger = new DistanceTrigger(this->getContext());23 distancetrigger->setDistance(100);24 this->attach(distancetrigger);25 */23 //model->setPosition(Vector3(0.0,0.0,0.0)); // this is wrong, it has to be triggered 24 //waypoint_active = false; 25 //distancetrigger = new DistanceTrigger(this->getContext()); 26 //distancetrigger->setDistance(100); 27 //this->attach(distancetrigger); 28 26 29 } 27 30 … … 35 38 //setOrientation() 36 39 37 Waypoint* WaypointGroup::getWaypoint(){ 38 for (Waypoint* waypoint : this->waypoints_){ 39 if(!(waypoint->waypoint_actived)){ 40 waypoint->enable_waypoint(); 41 return waypoint; 40 41 42 43 Waypoint* WaypointGroup::getWaypoint(unsigned int index) 44 { 45 unsigned int i = 0; 46 for (Waypoint* child : this->waypoints_) 47 { 48 if (i == index) 49 return child; 50 ++i; 51 } 52 return nullptr; 53 } 54 55 void WaypointGroup::setWaypoint(Waypoint* object) 56 { 57 this->waypoints_.insert(object); 58 } 59 60 61 Waypoint* WaypointGroup::getActive(){ 62 for (Waypoint* object : this->waypoints_){ 63 if(!(object->waypoint_actived)){ 64 object->enable_waypoint(); 65 return object; 42 66 } 43 67 } … … 45 69 46 70 47 Waypoint* WaypointGroup::getWaypoint(unsigned int index)48 {49 unsigned int i = 0;50 for (Waypoint* waypoint : this->waypoints_)51 {52 53 if (i == index)54 return waypoint;55 ++i;56 }57 return nullptr;58 }59 71 60 void WaypointGroup::addWaypoint(Waypoint* object) 61 { 62 this->waypoints_.insert(object); 72 73 74 void WaypointGroup::XMLPort(Element& xmlelement, XMLPort::Mode mode){ 75 SUPER(WaypointGroup, XMLPort, xmlelement, mode); // From the SpaceShip.cc file 76 XMLPortObject(WaypointGroup, Waypoint, "waypoints", setWaypoint, getWaypoint, xmlelement, mode); 77 63 78 } 64 79 65 80 66 81 67 void Waypoint::XMLPort(Element& xmlelement, XMLPort::Mode mode){68 SUPER(Waypoint, XMLPort, xmlelement, mode); // From the SpaceShip.cc file69 XMLPortObject(WaypointGroup, Waypoint, "waypoints", addWaypoint, getWaypoint, xmlelement, mode);70 71 }72 73 74 82 } -
code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h
r11274 r11287 1 1 2 2 3 #ifndef _Waypoint _H__4 #define _Waypoint _H__3 #ifndef _WaypointGroup_H__ 4 #define _WaypointGroup_H__ 5 5 6 6 #include "OrxonoxPrereqs.h" 7 #include " StaticEntity.h"7 #include "worldentities/StaticEntity.h" 8 8 #include "graphics/Model.h" 9 #include " modules/objects/triggers/DistanceTrigger.h"9 #include "objects/triggers/DistanceTrigger.h" 10 10 11 11 #include <map> 12 12 #include <string> 13 13 14 #include "core/CoreIncludes.h" 14 15 #include "util/OgreForwardRefs.h" 15 #include "tools/interfaces/Tickable.h" 16 #include "Waypoints.h" 16 #include "Waypoint.h" 17 17 18 18 namespace orxonox … … 40 40 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 41 41 42 //Waypoint* getWaypoint(); 42 43 Waypoint* getWaypoint(unsigned int index); 44 void setWaypoint(Waypoint* object); 43 45 44 Way 46 47 45 48 46 49 … … 54 57 //virtual bool isCollisionTypeLegal(CollisionType type) const override; 55 58 56 std::set<Waypoint*> waypoints ;59 std::set<Waypoint*> waypoints_; 57 60 58 61 // network callbacks -
code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc
r11274 r11287 14 14 RegisterObject(Waypointarrow); 15 15 model = new Model(this->getContext()); 16 model->setMeshSource(" Arrow.mesh"); // Name of the arrow file for now bottle16 model->setMeshSource("cokebottle.mesh"); // Name of the arrow file for now bottle 17 17 this->attach(model); 18 18 model->setScale(3); 19 model->setOrientation(Vector3(0,0,-1));19 // model->setOrientation(Vector3(0,0,-1)); 20 20 model->setPosition(Vector3(0,15,0)); 21 21 22 } 22 23 -
code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.h
r11274 r11287 1 1 2 2 3 #ifndef _Waypoint _H__4 #define _Waypoint _H__3 #ifndef _Waypointarrow_H__ 4 #define _Waypointarrow_H__ 5 5 6 6 #include "OrxonoxPrereqs.h" 7 #include " StaticEntity.h"7 #include "worldentities/StaticEntity.h" 8 8 #include "graphics/Model.h" 9 9 10 #include <map>11 10 #include <string> 12 11 … … 15 14 #include "interfaces/RadarListener.h" 16 15 #include "WaypointGroup.h" 16 #include "core/XMLPort.h" 17 17 18 18 19 namespace orxonox
Note: See TracChangeset
for help on using the changeset viewer.