[8514] | 1 | |
---|
| 2 | /*! |
---|
| 3 | * @file generic_npc.h |
---|
| 4 | * generic npc object |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #ifndef _GENERIC_ENTITY_H |
---|
| 8 | #define _GENERIC_ENTITY_H |
---|
| 9 | |
---|
| 10 | #include "npc.h" |
---|
| 11 | |
---|
| 12 | #include <string> |
---|
[8793] | 13 | |
---|
[8516] | 14 | #include "sound_source.h" |
---|
[8514] | 15 | |
---|
[8793] | 16 | #include "vector.h" |
---|
[8796] | 17 | #include "quaternion.h" |
---|
[8793] | 18 | |
---|
| 19 | |
---|
[8516] | 20 | namespace OrxSound{ class SoundSource; } |
---|
| 21 | namespace OrxSound{ class SoundBuffer; } |
---|
[8514] | 22 | |
---|
| 23 | class TiXmlElement; |
---|
[8802] | 24 | class Animation3D; |
---|
[8514] | 25 | |
---|
| 26 | |
---|
| 27 | class GenericNPC : public NPC |
---|
| 28 | { |
---|
| 29 | public: |
---|
[8894] | 30 | GenericNPC(); |
---|
[8514] | 31 | GenericNPC(const TiXmlElement* root); |
---|
| 32 | virtual ~GenericNPC (); |
---|
| 33 | |
---|
| 34 | void init(); |
---|
| 35 | virtual void loadParams(const TiXmlElement* root); |
---|
| 36 | |
---|
| 37 | void setAnimation(int animationIndex, int animPlaybackMode); |
---|
[8516] | 38 | /** sets the sound volume to @param vol: volume of the sound */ |
---|
| 39 | inline void setVolume(float vol) { this->soundVolume = vol; } |
---|
[8514] | 40 | |
---|
[8705] | 41 | |
---|
[8894] | 42 | /* npc controlling functions */ |
---|
[8705] | 43 | |
---|
[8894] | 44 | /* walking functions */ |
---|
[8783] | 45 | float walkTo(const Vector& coordinate, const Quaternion& dir); |
---|
[8894] | 46 | float walkTo(float x, float y, float z); |
---|
[8783] | 47 | float walkTo(float x, float y, float z, float qu, float qx, float qy, float qz); |
---|
| 48 | float walkTo(float x, float y, float qu, float qx, float qy, float qz); |
---|
[8514] | 49 | |
---|
[8894] | 50 | /* running functions */ |
---|
[8783] | 51 | float runTo(const Vector& coordinate, const Quaternion& dir); |
---|
| 52 | float runTo(float x, float y, float z, float qu, float qx, float qy, float qz); |
---|
| 53 | float runTo(float x, float y, float qu, float qx, float qy, float qz); |
---|
| 54 | |
---|
[8894] | 55 | /* couching functinos */ |
---|
[8783] | 56 | float crouchTo(const Vector& coordinate, const Quaternion& dir); |
---|
| 57 | float crouchTo(float x, float y, float z, float qu, float qx, float qy, float qz); |
---|
| 58 | float crouchTo(float x, float y, float qu, float qx, float qy, float qz); |
---|
| 59 | |
---|
[8894] | 60 | /* stopping the movement */ |
---|
| 61 | void stop(); |
---|
| 62 | |
---|
| 63 | /* some oriantation functions */ |
---|
| 64 | float lookAt(WorldEntity* worldEntity); |
---|
| 65 | bool turnTo(float qu, float qx, float qy, float qz); |
---|
| 66 | |
---|
| 67 | /* talking funcitons*/ |
---|
[8796] | 68 | float talkTo(WorldEntity* worldEntity, int dialogNr); |
---|
[8783] | 69 | |
---|
[8894] | 70 | /* shooting functions */ |
---|
| 71 | void shootAt(WorldEntity* entity); |
---|
[8793] | 72 | |
---|
[8514] | 73 | |
---|
[8894] | 74 | /* some generic control funtions */ |
---|
| 75 | void playAnimation(int animationIndex, int animPlaybackMode); |
---|
| 76 | void playSound(std::string filename); |
---|
| 77 | void playSound(int i); |
---|
| 78 | |
---|
| 79 | void setTime(float newTime){ this->time = newTime; }; |
---|
| 80 | |
---|
[8514] | 81 | virtual void tick (float time); |
---|
| 82 | |
---|
| 83 | |
---|
[8894] | 84 | void destroy(); |
---|
| 85 | |
---|
| 86 | |
---|
[8514] | 87 | private: |
---|
[8516] | 88 | OrxSound::SoundSource soundSource; |
---|
| 89 | OrxSound::SoundBuffer* soundBuffer; |
---|
| 90 | float soundVolume; |
---|
[8793] | 91 | |
---|
| 92 | Vector destCoor; |
---|
| 93 | Quaternion destDir; |
---|
[8802] | 94 | |
---|
| 95 | Animation3D* currentAnim; |
---|
[8894] | 96 | float time; //!< Duration of the action |
---|
[8514] | 97 | }; |
---|
| 98 | |
---|
| 99 | #endif /* _GENERIC_ENTITY_H */ |
---|