#ifndef _GATE_H #define _GATE_H #include "world_entity.h" #include "md2/md2Model.h" class TiXmlElement; //! animation names enumeration typedef enum GateAnimType { GATE_OPEN = 0, GATE_CLOSE, GATE_DIE, GATE_MAX_ANIMATIONS }; class Gate : public WorldEntity { ObjectListDeclaration(Gate); public: Gate(const TiXmlElement* root = NULL); virtual ~Gate (); virtual void loadParams(const TiXmlElement* root); void setActionRadius(float radius) { this->actionRadius = radius; } void setScale(float scale) { this->scale = scale; } void open(); void close(); void destroy(); void lock() { this->bLocked = true; } void unlock() { this->bLocked = false; } bool isLocked() const { return this->bLocked; } virtual void tick (float time); private: void init(); bool checkOpen(); void setAnimation(int animNum, int playbackMode = 0); private: bool destroyed; //!< true if the door is destroyed bool bOpen; //!< true if the door is open bool bLocked; //!< true if this door is locked float actionRadius; //!< action radius float scale; //!< the scale of the model static sAnim animationList[3]; //!< list of the animations bool bDead; }; #endif /* _GATE_H */