[11274] | 1 | #include "Waypoint.h" |
---|
| 2 | |
---|
| 3 | #include <OgreSceneNode.h> |
---|
| 4 | #include <BulletDynamics/Dynamics/btRigidBody.h> |
---|
| 5 | #include "util/OrxAssert.h" |
---|
| 6 | #include "core/CoreIncludes.h" |
---|
| 7 | |
---|
| 8 | namespace orxonox |
---|
| 9 | { |
---|
| 10 | RegisterClass(WaypointGroup); |
---|
| 11 | |
---|
| 12 | WaypointGroup::WaypointGroup(Context* context) : StaticEntity(context) |
---|
| 13 | { |
---|
| 14 | /*RegisterObject(Waypoint); |
---|
| 15 | model = new Model(this->getContext()); |
---|
| 16 | model->setMeshSource("cube.mesh"); // Name of the arrow file for now bottle |
---|
| 17 | this->attach(model); |
---|
| 18 | model->setScale(3); |
---|
| 19 | //model->setOrientation(Vector3(0,0,-1)); |
---|
| 20 | model->setPosition(Vector3(0.0,0.0,0.0)); // this is wrong, it has to be triggered |
---|
| 21 | waypoint_active = false; |
---|
| 22 | distancetrigger = new DistanceTrigger(this->getContext()); |
---|
| 23 | distancetrigger->setDistance(100); |
---|
| 24 | this->attach(distancetrigger); |
---|
| 25 | */ |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | WaypointGroup::~WaypointGroup() |
---|
| 29 | { |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | //WorldEntity::setDirection |
---|
| 34 | //WorldEntity::getPosition() |
---|
| 35 | //setOrientation() |
---|
| 36 | |
---|
| 37 | Waypoint* WaypointGroup::getWaypoint(){ |
---|
| 38 | for (Waypoint* waypoint : this->waypoints_){ |
---|
| 39 | if(!(waypoint->waypoint_actived)){ |
---|
| 40 | waypoint->enable_waypoint(); |
---|
| 41 | return waypoint; |
---|
| 42 | } |
---|
| 43 | } |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | |
---|
| 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 | |
---|
| 60 | void WaypointGroup::addWaypoint(Waypoint* object) |
---|
| 61 | { |
---|
| 62 | this->waypoints_.insert(object); |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | void Waypoint::XMLPort(Element& xmlelement, XMLPort::Mode mode){ |
---|
| 68 | SUPER(Waypoint, XMLPort, xmlelement, mode); // From the SpaceShip.cc file |
---|
| 69 | XMLPortObject(WaypointGroup, Waypoint, "waypoints", addWaypoint, getWaypoint, xmlelement, mode); |
---|
| 70 | |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | } |
---|