Rev | Line | |
---|
[10423] | 1 | /*! |
---|
| 2 | * @file mover.h |
---|
| 3 | * Mover is an object which moves from its origin to relatively given coordinates |
---|
| 4 | * within a given action-time as soon as the player enters the action-radius. |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #ifndef _MOVER_H |
---|
| 8 | #define _MOVER_H |
---|
| 9 | |
---|
| 10 | /* INCLUDES */ |
---|
| 11 | #include "world_entity.h" |
---|
| 12 | |
---|
| 13 | //! A Class to handle a Mover |
---|
| 14 | class Mover : public WorldEntity |
---|
| 15 | { |
---|
| 16 | ObjectListDeclaration(Mover); |
---|
| 17 | public: |
---|
| 18 | typedef enum MoverState { |
---|
| 19 | Closed = 0, |
---|
| 20 | Opening = 1, |
---|
| 21 | Open = 2, |
---|
| 22 | Closing = 3, |
---|
| 23 | Locked = 4 |
---|
| 24 | }; |
---|
| 25 | |
---|
| 26 | Mover(const TiXmlElement* root = NULL); |
---|
| 27 | virtual ~Mover(); |
---|
| 28 | |
---|
| 29 | virtual void loadParams(const TiXmlElement* root); |
---|
| 30 | |
---|
| 31 | void setTargetCoordinates(float x, float y, float z) { this->targetCoordinates = Vector(x,y,z); } |
---|
| 32 | void setActionRadius(float radius) { this->actionRadius = radius; } |
---|
| 33 | void setActionTime(float time) { this->actionTime = time; } |
---|
| 34 | |
---|
| 35 | virtual void tick(float dt); |
---|
| 36 | |
---|
| 37 | private: |
---|
| 38 | bool checkOpen(float dt); |
---|
| 39 | bool checkClosed(float dt); |
---|
| 40 | bool checkPlayerInActionRadius(); |
---|
| 41 | |
---|
| 42 | private: |
---|
| 43 | Vector targetCoordinates; //!< the target coordinates |
---|
| 44 | Vector originCoordinates; //!< the origin coordinates |
---|
| 45 | float actionRadius; //!< the action-radius |
---|
| 46 | float actionTime; //!< the action-time |
---|
| 47 | int state; //!< the state of the mover |
---|
| 48 | }; |
---|
| 49 | |
---|
| 50 | #endif /* _MOVER_H */ |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | |
---|
Note: See
TracBrowser
for help on using the repository browser.