[4855] | 1 | /*! |
---|
| 2 | * @file mover.h |
---|
| 3 | * A mover is an object that moves along scripted paths, released by scripted events. |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _MOVER_H |
---|
| 7 | #define _MOVER_H |
---|
| 8 | |
---|
| 9 | #include "world_entity.h" |
---|
| 10 | #include "mover_trigger.h" |
---|
| 11 | #include "mover_station.h" |
---|
| 12 | #include "mover_trigger_list.h" |
---|
| 13 | #include "mover_station_list.h" |
---|
| 14 | #include "sound_source.h" |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | class Mover : public WorldEntity |
---|
| 18 | { |
---|
| 19 | ObjectListDeclaration(Mover); |
---|
| 20 | |
---|
| 21 | public: |
---|
| 22 | Mover(const TiXmlElement* root = NULL); |
---|
| 23 | virtual ~Mover(); |
---|
| 24 | |
---|
| 25 | virtual void loadParams(const TiXmlElement* root); |
---|
| 26 | virtual void tick(float dt); |
---|
| 27 | |
---|
| 28 | void setLoop(bool bLoop = true) { this->bLoop = bLoop; } |
---|
| 29 | void setRepeat(int n) { this->bRepeat = true; this->repeats = n; } |
---|
| 30 | void setWaitAfterEachStation(bool bWaitAfterEachStation = true) { this->bWaitAfterEachStation = bWaitAfterEachStation; } |
---|
| 31 | void setOnlyMoveWhileTriggered(bool bOnlyMoveWhileTriggered = true) { this->bOnlyMoveWhileTriggered = bOnlyMoveWhileTriggered; } |
---|
| 32 | void setAttachTrigger(bool bAttachTrigger = true) { this->bAttachTrigger = bAttachTrigger; } |
---|
| 33 | void setTriggers(const TiXmlElement* root); |
---|
| 34 | void setStations(const TiXmlElement* root); |
---|
| 35 | void setReopen(bool bReopen = true) { this->bReopen = bReopen; } |
---|
| 36 | void setReclose(bool bReclose = true) { this->bReclose = bReclose; } |
---|
| 37 | |
---|
| 38 | private: |
---|
| 39 | void changeState(int state); |
---|
| 40 | int closed(); |
---|
| 41 | int open(); |
---|
| 42 | int move(float dt); |
---|
| 43 | int wait(); |
---|
| 44 | int next(); |
---|
| 45 | int delay(); |
---|
| 46 | int stay(); |
---|
| 47 | bool reachedStationsTarget(float dt); |
---|
| 48 | Quaternion VtoQ(Vector v) { return Quaternion(v.x, v.y, v.z); } |
---|
| 49 | Vector QtoV(Quaternion Q) { return Vector(); } |
---|
| 50 | |
---|
| 51 | bool bLoop; |
---|
| 52 | bool bRepeat; |
---|
| 53 | int repeats; |
---|
| 54 | bool bWaitAfterEachStation; |
---|
| 55 | bool bOnlyMoveWhileTriggered; |
---|
| 56 | bool bAttachTrigger; |
---|
| 57 | bool bReopen; |
---|
| 58 | bool bReclose; |
---|
| 59 | |
---|
| 60 | MoverTriggerList *triggers; |
---|
| 61 | MoverStationList *stations; |
---|
| 62 | |
---|
| 63 | int state; |
---|
| 64 | MoverStation *station; |
---|
| 65 | float time; |
---|
| 66 | int repeatsToGo; |
---|
| 67 | Vector originCoor; |
---|
| 68 | Vector originDir; |
---|
| 69 | |
---|
| 70 | OrxSound::SoundSource soundSource_starting; |
---|
| 71 | OrxSound::SoundSource soundSource_moving; |
---|
| 72 | OrxSound::SoundSource soundSource_ending; |
---|
| 73 | }; |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | #endif |
---|