Changeset 11318 for code/branches/QuestGuide_HS16/src/modules
- Timestamp:
- Dec 5, 2016, 3:59:38 PM (8 years ago)
- Location:
- code/branches/QuestGuide_HS16/src/modules/waypoints
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.cc
r11309 r11318 1 1 #include "Waypoint.h" 2 3 2 #include <OgreSceneNode.h> 4 3 #include <BulletDynamics/Dynamics/btRigidBody.h> … … 6 5 #include "core/CoreIncludes.h" 7 6 #include "core/XMLPort.h" 7 #include "WaypointGroup.h" 8 #include "core/EventIncludes.h" 8 9 9 10 … … 26 27 distancetrigger = new DistanceTrigger(this->getContext()); 27 28 distancetrigger->setDistance(100); 28 distance Trigger_->addTarget("Pawn");29 this->addEventSource(distanceTrigger_, "explode");30 29 distancetrigger->addTarget("Pawn"); 30 distancetrigger->setStayActive(false); 31 this->addEventSource(distancetrigger, "activate"); 31 32 this->attach(distancetrigger); 32 33 } … … 37 38 38 39 40 void Waypoint::activate(){ 41 orxout() << "activate function" << endl; 42 ///++order; 43 waypointgroup->activateNext(); 44 } 45 46 39 47 //WorldEntity::setDirection 40 48 //WorldEntity::getPosition() 41 49 //setOrientation() 50 42 51 43 44 void Waypoint::XMLPort(Element& xmlelement, XMLPort::Mode mode){ 45 SUPER(Waypoint, XMLPort, xmlelement, mode); // From the SpaceShip.cc file 46 47 XMLPortParam(Waypoint, "order", setOrder, getOrder, xmlelement, mode); 52 void Waypoint::XMLEventPort(Element& xmlelement, XMLPort::Mode mode){ 53 SUPER(Waypoint, XMLEventPort, xmlelement, mode); // From the SpaceShip.cc file 54 //XMLPortParam(Waypoint, "order", setOrder, getOrder, xmlelement, mode); 55 XMLPortEventState(Waypoint, BaseObject, "activate", activate, xmlelement, mode); 48 56 49 57 } -
code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h
r11298 r11318 5 5 6 6 #include "OrxonoxPrereqs.h" 7 #include "Waypointprereqs.h" 7 8 #include "worldentities/StaticEntity.h" 8 9 #include "graphics/Model.h" … … 14 15 #include "util/OgreForwardRefs.h" 15 16 #include "tools/interfaces/Tickable.h" 17 #include "WaypointGroup.h" 18 16 19 17 20 namespace orxonox … … 37 40 38 41 39 virtual void XML Port(Element& xmlelement, XMLPort::Mode mode) override;42 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 40 43 41 44 inline void enable_waypoint(){ … … 51 54 } 52 55 56 inline void setWaypointGroup(WaypointGroup* waypointgroup_){ 57 this->waypointgroup = waypointgroup_; 58 } 59 60 void activate(); 61 53 62 54 63 bool waypoint_actived; … … 59 68 Model* model; 60 69 DistanceTrigger* distancetrigger; 61 int order; 62 70 unsigned int order = 0; 71 WaypointGroup* waypointgroup; 72 63 73 // network callbacks 64 74 }; -
code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc
r11309 r11318 17 17 RegisterObject(WaypointGroup); 18 18 activeWaypoint = nullptr; 19 current = 0; 19 20 20 21 //model = new Model(this->getContext()); … … 25 26 //model->setPosition(Vector3(0.0,0.0,0.0)); // this is wrong, it has to be triggered 26 27 //waypoint_active = false; 27 //distancetrigger = new DistanceTrigger(this->getContext()); 28 //distancetrigger = new DistanceTrigger(this->getContext()); 28 29 //distancetrigger->setDistance(100); 29 30 //this->attach(distancetrigger); 30 31 31 32 } 32 33 … … 40 41 //setOrientation() 41 42 42 43 43 44 44 45 … … 57 58 void WaypointGroup::setWaypoint(Waypoint* object) 58 59 { 60 object->setWaypointGroup(this); 59 61 this->waypoints_.insert(object); 60 62 } 61 63 64 void WaypointGroup::activateNext(){ 65 if (std::next(waypoints_.begin(), current) != std::next(waypoints_.end(), 0)){ 66 activeWaypoint = *std::next(waypoints_.begin(), current); 67 ++current; 68 } 69 } 62 70 63 71 Waypoint* WaypointGroup::getActive(){ 64 72 if (activeWaypoint == nullptr){ 65 73 orxout() << "Null Pointer" << endl; 66 activ ateNext();74 activeWaypoint = getFirst(); 67 75 68 } 69 //else if (activeWaypoint->) 76 } 70 77 return activeWaypoint; 71 78 } 72 79 73 Waypoint* WaypointGroup::activateNext(){ 74 for (Waypoint* object : this->waypoints_){ 75 if(!(object->waypoint_actived)){ 76 object->enable_waypoint(); 77 activeWaypoint = object; 78 break; 79 } 80 } 81 return activeWaypoint; 80 // Waypoint* WaypointGroup::activateNext(){ 81 // for (Waypoint* object : this->waypoints_){ 82 // if(!(object->waypoint_actived)){ 83 // //object->enable_waypoint(); 84 // activeWaypoint = object; 85 // break; 86 // } 87 // } 88 // return activeWaypoint; 89 // } 90 91 Waypoint* WaypointGroup::getFirst(){ 92 std::set<Waypoint*>::iterator it = waypoints_.begin(); 93 return *it; 82 94 } 83 95 84 96 85 86 97 87 98 void WaypointGroup::XMLPort(Element& xmlelement, XMLPort::Mode mode){ -
code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h
r11298 r11318 5 5 6 6 #include "OrxonoxPrereqs.h" 7 #include "Waypointprereqs.h" 7 8 #include "worldentities/StaticEntity.h" 8 9 #include "graphics/Model.h" … … 31 32 32 33 class _OrxonoxExport WaypointGroup : public StaticEntity { 33 34 34 35 public: 35 36 … … 46 47 47 48 Waypoint* getActive(); 48 49 49 50 Waypoint* activateNext();51 50 52 51 void activateNext(); 53 52 54 53 Waypoint* getFirst(); 54 55 56 57 55 58 56 59 57 60 private: 58 61 59 62 //virtual bool isCollisionTypeLegal(CollisionType type) const override; 60 63 61 64 std::set<Waypoint*> waypoints_; 62 65 Waypoint* activeWaypoint; 66 unsigned int current = 1; 67 //std::set<Waypoint*>::iterator it; 63 68 64 69 // network callbacks -
code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc
r11309 r11318 61 61 62 62 if (getWaypointgroup() == nullptr){ 63 63 //orxout() << "Second" << endl; 64 64 65 65 return; … … 67 67 68 68 waypoints_ = getWaypointgroup(); 69 70 69 waypoint = waypoints_->getActive(); 71 72 70 Vector3 waypoint_position = waypoint->getWorldPosition(); 73 71 74 72 75 73 //orxout() << "dsfsf" << waypoint_position.x << endl; 76 //orxout() << "waypoint " << waypoint_position.x << "waypoint " << waypoint_position.y << "waypoint " << waypoint_position.z << endl;77 //orxout() << "model " << this->model->getWorldPosition().x << "model " << this->model->getWorldPosition().y << "model " << this->model->getWorldPosition().z << endl;78 //orxout() << "this " << this->getWorldPosition().x << "this " << this->getWorldPosition().y << "this " << this->getWorldPosition().z << endl;79 //orxout() << "trial " << trial.x << "trial " << trial.y << "trial " << trial.z << endl;74 //orxout() << "waypoint " << waypoint_position.x << "waypoint " << waypoint_position.y << "waypoint " << waypoint_position.z << endl; 75 //orxout() << "model " << this->model->getWorldPosition().x << "model " << this->model->getWorldPosition().y << "model " << this->model->getWorldPosition().z << endl; 76 //orxout() << "this " << this->getWorldPosition().x << "this " << this->getWorldPosition().y << "this " << this->getWorldPosition().z << endl; 77 //orxout() << "trial " << trial.x << "trial " << trial.y << "trial " << trial.z << endl; 80 78 81 79 … … 88 86 void Waypointarrow::XMLPort(Element& xmlelement, XMLPort::Mode mode){ 89 87 SUPER(Waypointarrow, XMLPort, xmlelement, mode); // From the SpaceShip.cc file 90 91 88 //XMLPortParamTemplate(WorldEntity, "orientation", setOrientation, getOrientation, xmlelement, mode, Vector3) 92 93 89 //XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode); // TRY ADDING THE WAYPOINT ARROW LIKE AN ENGINE 94 90
Note: See TracChangeset
for help on using the changeset viewer.