[11274] | 1 | #include "Waypoint.h" |
---|
| 2 | #include <OgreSceneNode.h> |
---|
| 3 | #include <BulletDynamics/Dynamics/btRigidBody.h> |
---|
| 4 | #include "util/OrxAssert.h" |
---|
| 5 | #include "core/CoreIncludes.h" |
---|
[11287] | 6 | #include "core/XMLPort.h" |
---|
[11318] | 7 | #include "WaypointGroup.h" |
---|
| 8 | #include "core/EventIncludes.h" |
---|
[11274] | 9 | |
---|
[11287] | 10 | |
---|
[11274] | 11 | namespace orxonox |
---|
[11287] | 12 | |
---|
| 13 | |
---|
[11274] | 14 | { |
---|
| 15 | RegisterClass(Waypoint); |
---|
| 16 | |
---|
| 17 | Waypoint::Waypoint(Context* context) : StaticEntity(context) |
---|
| 18 | { |
---|
| 19 | RegisterObject(Waypoint); |
---|
| 20 | model = new Model(this->getContext()); |
---|
| 21 | model->setMeshSource("cube.mesh"); // Name of the arrow file for now bottle |
---|
| 22 | this->attach(model); |
---|
[11332] | 23 | model->setScale(0); |
---|
[11274] | 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_actived = false; |
---|
[11332] | 27 | distancetrigger = new DistanceTrigger(this->getContext()); |
---|
[11274] | 28 | distancetrigger->setDistance(100); |
---|
[11318] | 29 | distancetrigger->addTarget("Pawn"); |
---|
| 30 | distancetrigger->setStayActive(false); |
---|
| 31 | this->addEventSource(distancetrigger, "activate"); |
---|
[11274] | 32 | this->attach(distancetrigger); |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | Waypoint::~Waypoint() |
---|
| 36 | { |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | |
---|
[11318] | 40 | void Waypoint::activate(){ |
---|
[11332] | 41 | orxout() << "activate function" << endl; |
---|
[11318] | 42 | ///++order; |
---|
| 43 | waypointgroup->activateNext(); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | |
---|
[11274] | 47 | //WorldEntity::setDirection |
---|
| 48 | //WorldEntity::getPosition() |
---|
| 49 | //setOrientation() |
---|
| 50 | |
---|
[11332] | 51 | |
---|
[11318] | 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); |
---|
[11274] | 56 | |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | } |
---|