1 | #include "Waypoint.h" |
---|
2 | #include <OgreSceneNode.h> |
---|
3 | #include <BulletDynamics/Dynamics/btRigidBody.h> |
---|
4 | #include "util/OrxAssert.h" |
---|
5 | #include "core/CoreIncludes.h" |
---|
6 | #include "core/XMLPort.h" |
---|
7 | #include "WaypointGroup.h" |
---|
8 | #include "core/EventIncludes.h" |
---|
9 | |
---|
10 | |
---|
11 | namespace orxonox |
---|
12 | |
---|
13 | |
---|
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); |
---|
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_actived = false; |
---|
27 | distancetrigger = new DistanceTrigger(this->getContext()); |
---|
28 | distancetrigger->setDistance(100); |
---|
29 | distancetrigger->addTarget("Pawn"); |
---|
30 | distancetrigger->setStayActive(false); |
---|
31 | this->addEventSource(distancetrigger, "activate"); |
---|
32 | this->attach(distancetrigger); |
---|
33 | } |
---|
34 | |
---|
35 | Waypoint::~Waypoint() |
---|
36 | { |
---|
37 | } |
---|
38 | |
---|
39 | |
---|
40 | void Waypoint::activate(){ |
---|
41 | orxout() << "activate function" << endl; |
---|
42 | ///++order; |
---|
43 | waypointgroup->activateNext(); |
---|
44 | } |
---|
45 | |
---|
46 | |
---|
47 | //WorldEntity::setDirection |
---|
48 | //WorldEntity::getPosition() |
---|
49 | //setOrientation() |
---|
50 | |
---|
51 | |
---|
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); |
---|
56 | |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | } |
---|