[4844] | 1 | /*! |
---|
| 2 | * @file mover_trigger.h |
---|
| 3 | * Base-class for all mover triggers and container for an independent triggerlist. |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _MOVER_TRIGGER_H |
---|
| 7 | #define _MOVER_TRIGGER_H |
---|
| 8 | |
---|
| 9 | #include "world_entity.h" |
---|
| 10 | #include "mover_trigger_list.h" |
---|
| 11 | #include "mover_trigger_event_list.h" |
---|
| 12 | #include "mover_trigger_delay_list.h" |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | class MoverTriggerList; |
---|
| 16 | class MoverTriggerEventList; |
---|
| 17 | |
---|
| 18 | class MoverTrigger : public WorldEntity |
---|
| 19 | { |
---|
| 20 | ObjectListDeclaration(MoverTrigger); |
---|
| 21 | |
---|
| 22 | public: |
---|
| 23 | MoverTrigger(const TiXmlElement* root = NULL); |
---|
| 24 | virtual ~MoverTrigger(); |
---|
| 25 | |
---|
| 26 | virtual void loadParams(const TiXmlElement* root); |
---|
| 27 | virtual void tick(float dt); |
---|
| 28 | |
---|
| 29 | void setRelCoor(float x, float y, float z) { this->relCoor = Vector(x, y, z); } |
---|
| 30 | void updateCoordinates(Vector baseCoor); |
---|
| 31 | void setDelay(float delay) { this->delay = delay; } |
---|
| 32 | void setStayTriggered(bool bStayTriggered = true) { this->bStayTriggered = bStayTriggered; } |
---|
| 33 | void setTriggerOnceOnly(bool bTriggerOnceOnly = true) { this->bTriggerOnceOnly = bTriggerOnceOnly; } |
---|
| 34 | void setInvert(bool bInvert = true) { this->bInvert = bInvert; } |
---|
| 35 | void setSwitch(bool bSwitch = true) { this->bSwitch = bSwitch; } |
---|
| 36 | void setObligatory(bool bObligatory = true) { this->bObligatory = bObligatory; } |
---|
| 37 | void setTriggers(const TiXmlElement* root); |
---|
| 38 | void setBaseCoor(Vector baseCoor); |
---|
| 39 | |
---|
| 40 | bool isTriggered(); |
---|
| 41 | bool isObligatory(); |
---|
| 42 | static MoverTriggerEventList *events; |
---|
| 43 | std::string getName() { return this->objectName; } |
---|
| 44 | static MoverTrigger *createTrigger(const TiXmlElement* root); |
---|
| 45 | |
---|
| 46 | protected: |
---|
| 47 | void init_post_params(); |
---|
| 48 | |
---|
| 49 | bool bIsTriggered; |
---|
| 50 | |
---|
| 51 | private: |
---|
| 52 | void init_prae_params(); |
---|
| 53 | virtual bool checkIsTriggered(); |
---|
| 54 | |
---|
| 55 | Vector relCoor; |
---|
| 56 | float delay; |
---|
| 57 | bool bIsWaitingForDelay; |
---|
| 58 | bool bStayTriggered; |
---|
| 59 | bool bTriggerOnceOnly; |
---|
| 60 | bool bInvert; |
---|
| 61 | bool bSwitch; |
---|
| 62 | bool bObligatory; |
---|
| 63 | float time; |
---|
| 64 | bool bFirstRelease; |
---|
| 65 | bool oldState; |
---|
| 66 | |
---|
| 67 | MoverTriggerList *triggers; |
---|
| 68 | MoverTriggerDelayList *delaylist; |
---|
| 69 | }; |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | #endif |
---|
| 73 | |
---|