Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc @ 11309

Last change on this file since 11309 was 11309, checked in by ooguz, 7 years ago

Distance Trigger base methods

File size: 2.3 KB
Line 
1#include "Waypoint.h"
2
3#include <OgreSceneNode.h>
4#include <BulletDynamics/Dynamics/btRigidBody.h>
5#include "util/OrxAssert.h"
6#include "WaypointGroup.h"
7#include "core/CoreIncludes.h"
8#include "core/XMLPort.h"
9
10
11namespace orxonox
12{
13    RegisterClass(WaypointGroup);
14
15    WaypointGroup::WaypointGroup(Context* context) : StaticEntity(context)
16    {
17        RegisterObject(WaypointGroup);
18        activeWaypoint = nullptr;
19
20        //model = new Model(this->getContext());
21        //model->setMeshSource("cube.mesh");  // Name of the arrow file for now bottle
22        //is->attach(model);
23        //model->setScale(3);
24        //model->setOrientation(Vector3(0,0,-1));
25        //model->setPosition(Vector3(0.0,0.0,0.0));        // this is wrong, it has to be triggered
26        //waypoint_active = false;
27        //distancetrigger = new DistanceTrigger(this->getContext());   
28        //distancetrigger->setDistance(100);
29        //this->attach(distancetrigger);
30       
31    }
32
33    WaypointGroup::~WaypointGroup()
34    {
35    }
36
37
38     //WorldEntity::setDirection
39     //WorldEntity::getPosition()
40     //setOrientation()
41
42 
43
44
45    Waypoint* WaypointGroup::getWaypoint(unsigned int index)
46    {
47        unsigned int i = 0;
48        for (Waypoint* child : this->waypoints_)
49        {
50            if (i == index)
51                return child;
52            ++i;
53        }
54        return nullptr;
55    }
56
57    void WaypointGroup::setWaypoint(Waypoint* object)
58    {
59        this->waypoints_.insert(object);
60    }
61
62
63    Waypoint* WaypointGroup::getActive(){
64          if (activeWaypoint == nullptr){
65            orxout() << "Null Pointer" << endl;
66            activateNext();
67
68          } 
69          //else if (activeWaypoint->)           
70          return activeWaypoint;
71    }
72
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;
82    }
83
84
85   
86
87    void WaypointGroup::XMLPort(Element& xmlelement, XMLPort::Mode mode){
88        SUPER(WaypointGroup, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
89        XMLPortObject(WaypointGroup, Waypoint, "waypoints", setWaypoint, getWaypoint, xmlelement, mode);
90
91    }
92
93
94
95}
Note: See TracBrowser for help on using the repository browser.