/*! * @file mover.h * Mover is an object which moves from its origin to relatively given coordinates * within a given action-time as soon as the player enters the action-radius. */ #ifndef _MOVER_H #define _MOVER_H /* INCLUDES */ #include "world_entity.h" #include "sound_buffer.h" #include "sound_source.h" //! A Class to handle a Mover class Mover : public WorldEntity { ObjectListDeclaration(Mover); public: typedef enum MoverState { Closed = 0, Opening = 1, Open = 2, Closing = 3, Locked = 4 }; Mover(const TiXmlElement* root = NULL); virtual ~Mover(); virtual void loadParams(const TiXmlElement* root); void setTargetCoordinates(float x, float y, float z) { this->targetCoordinates = Vector(x,y,z); } void setActionRadius(float radius) { this->actionRadius = radius; } void setActionTime(float time) { this->actionTime = time; } void setOpeningSoundFile(const std::string& fileName); void setOpenedSoundFile(const std::string& fileName); void setMovingSoundFile(const std::string& fileName); void setClosingSoundFile(const std::string& fileName); void setClosedSoundFile(const std::string& fileName); virtual void tick(float dt); private: bool checkOpen(float dt); bool checkClosed(float dt); bool checkPlayerInActionRadius(); OrxSound::SoundSource soundSource_starting; OrxSound::SoundSource soundSource_moving; OrxSound::SoundSource soundSource_ending; OrxSound::SoundBuffer soundBuffer_opening; OrxSound::SoundBuffer soundBuffer_opened; OrxSound::SoundBuffer soundBuffer_moving; OrxSound::SoundBuffer soundBuffer_closing; OrxSound::SoundBuffer soundBuffer_closed; Vector targetCoordinates; //!< the target coordinates Vector originCoordinates; //!< the origin coordinates float actionRadius; //!< the action-radius float actionTime; //!< the action-time int state; //!< the state of the mover }; #endif /* _MOVER_H */