- Timestamp:
- Nov 14, 2016, 3:57:03 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.