Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Bugs fixed

File size: 2.0 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        //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);
22        //model->setOrientation(Vector3(0,0,-1));
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       
29    }
30
31    WaypointGroup::~WaypointGroup()
32    {
33    }
34
35
36     //WorldEntity::setDirection
37     //WorldEntity::getPosition()
38     //setOrientation()
39
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;
66            }
67        }
68    }
69
70
71
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
78    }
79
80
81
82}
Note: See TracBrowser for help on using the repository browser.