/*! * @file mover.h * A mover is an object that moves along scripted paths, released by scripted events. */ #ifndef _MOVER_H #define _MOVER_H #include "world_entity.h" #include "mover_trigger.h" #include "mover_station.h" #include "mover_trigger_list.h" #include "mover_station_list.h" #include "sound_source.h" class Mover : public WorldEntity { ObjectListDeclaration(Mover); public: Mover(const TiXmlElement* root = NULL); virtual ~Mover(); virtual void loadParams(const TiXmlElement* root); virtual void tick(float dt); void setLoop(bool bLoop = true) { this->bLoop = bLoop; } void setRepeat(int n) { this->bRepeat = true; this->repeats = n; } void setWaitAfterEachStation(bool bWaitAfterEachStation = true) { this->bWaitAfterEachStation = bWaitAfterEachStation; } void setOnlyMoveWhileTriggered(bool bOnlyMoveWhileTriggered = true) { this->bOnlyMoveWhileTriggered = bOnlyMoveWhileTriggered; } void setAttachTrigger(bool bAttachTrigger = true) { this->bAttachTrigger = bAttachTrigger; } void setTriggers(const TiXmlElement* root); void setStations(const TiXmlElement* root); void setReopen(bool bReopen = true) { this->bReopen = bReopen; } void setReclose(bool bReclose = true) { this->bReclose = bReclose; } private: void changeState(int state); int closed(); int open(); int move(float dt); int wait(); int next(); int delay(); int stay(); bool reachedStationsTarget(float dt); Quaternion VtoQ(Vector v) { return Quaternion(v.x, v.y, v.z); } Vector QtoV(Quaternion Q) { return Vector(); } bool bLoop; bool bRepeat; int repeats; bool bWaitAfterEachStation; bool bOnlyMoveWhileTriggered; bool bAttachTrigger; bool bReopen; bool bReclose; MoverTriggerList *triggers; MoverStationList *stations; int state; MoverStation *station; float time; int repeatsToGo; Vector originCoor; Vector originDir; OrxSound::SoundSource soundSource_starting; OrxSound::SoundSource soundSource_moving; OrxSound::SoundSource soundSource_ending; }; #endif