/*! * @file generic_npc.h * generic npc object */ #ifndef _GENERIC_ENTITY_H #define _GENERIC_ENTITY_H #include "npc.h" #include #include "sound_source.h" #include "vector.h" #include "quaternion.h" namespace OrxSound{ class SoundSource; } namespace OrxSound{ class SoundBuffer; } class TiXmlElement; class Animation3D; class GenericNPC : public NPC { public: GenericNPC(); GenericNPC(const TiXmlElement* root); virtual ~GenericNPC (); void init(); virtual void loadParams(const TiXmlElement* root); void setAnimation(int animationIndex, int animPlaybackMode); /** sets the sound volume to @param vol: volume of the sound */ inline void setVolume(float vol) { this->soundVolume = vol; } /* npc controlling functions */ /* walking functions */ float walkTo(const Vector& coordinate, const Quaternion& dir); float walkTo(float x, float y, float z); float walkTo(float x, float y, float z, float qu, float qx, float qy, float qz); float walkTo(float x, float y, float qu, float qx, float qy, float qz); /* running functions */ float runTo(const Vector& coordinate, const Quaternion& dir); float runTo(float x, float y, float z, float qu, float qx, float qy, float qz); float runTo(float x, float y, float qu, float qx, float qy, float qz); /* couching functinos */ float crouchTo(const Vector& coordinate, const Quaternion& dir); float crouchTo(float x, float y, float z, float qu, float qx, float qy, float qz); float crouchTo(float x, float y, float qu, float qx, float qy, float qz); /* stopping the movement */ void stop(); /* some oriantation functions */ float lookAt(WorldEntity* worldEntity); bool turnTo(float qu, float qx, float qy, float qz); /* talking funcitons*/ float talkTo(WorldEntity* worldEntity, int dialogNr); /* shooting functions */ void shootAt(WorldEntity* entity); /* some generic control funtions */ void playAnimation(int animationIndex, int animPlaybackMode); void playSound(std::string filename); void playSound(int i); void setTime(float newTime){ this->time = newTime; }; virtual void tick (float time); void destroy(); private: OrxSound::SoundSource soundSource; OrxSound::SoundBuffer* soundBuffer; float soundVolume; Vector destCoor; Quaternion destDir; Animation3D* currentAnim; float time; //!< Duration of the action }; #endif /* _GENERIC_ENTITY_H */