Changeset 9003 in orxonox.OLD for trunk/src/world_entities/npcs/generic_npc.h
- Timestamp:
- Jul 2, 2006, 1:36:13 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/npcs/generic_npc.h
r8894 r9003 10 10 #include "npc.h" 11 11 12 #include <string>13 12 14 13 #include "sound_source.h" 15 16 #include "vector.h"17 #include "quaternion.h"18 19 14 20 15 namespace OrxSound{ class SoundSource; } … … 27 22 class GenericNPC : public NPC 28 23 { 24 25 29 26 public: 30 GenericNPC(); 31 GenericNPC(const TiXmlElement* root); 27 GenericNPC(const TiXmlElement* root = NULL); 32 28 virtual ~GenericNPC (); 33 29 34 void init();35 30 virtual void loadParams(const TiXmlElement* root); 36 31 37 void setAnimation(int animationIndex, int animPlaybackMode);38 32 /** sets the sound volume to @param vol: volume of the sound */ 39 33 inline void setVolume(float vol) { this->soundVolume = vol; } 40 34 41 35 42 /* npc controlling functions */43 36 37 bool finalGoalReached() { return this->behaviourList.empty(); }; 38 39 /* npc controlling functions to be Queued */ 44 40 /* walking functions */ 45 float walkTo(const Vector& coordinate, const Quaternion& dir); 46 float walkTo(float x, float y, float z); 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); 41 void walkTo(const Vector& coordinate); 42 void walkTo(float x, float y, float z); 49 43 50 44 /* running functions */ 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); 45 void runTo(const Vector& coordinate); 46 void runTo(float x, float y, float z); 54 47 55 48 /* couching functinos */ 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); 49 void crouchTo(const Vector& coordinate); 50 void crouchTo(float x, float y, float z); 59 51 60 52 /* stopping the movement */ 61 53 void stop(); 54 void nextStep(); 62 55 63 56 /* some oriantation functions */ 64 float lookAt(WorldEntity* worldEntity); 65 bool turnTo(float qu, float qx, float qy, float qz); 57 void lookAt(WorldEntity* worldEntity); 58 void turnTo(float qu, float qx, float qy, float qz); 59 void turnTo(float degreeInY); 66 60 67 61 /* talking funcitons*/ 68 floattalkTo(WorldEntity* worldEntity, int dialogNr);62 void talkTo(WorldEntity* worldEntity, int dialogNr); 69 63 70 64 /* shooting functions */ … … 77 71 void playSound(int i); 78 72 79 void setTime(float newTime){ this->time = newTime; };80 81 73 virtual void tick (float time); 82 74 … … 84 76 void destroy(); 85 77 78 private: 79 void init(); 80 81 void setAnimation(int animationIndex, int animPlaybackMode); 82 int getAnimation(); 83 bool isAnimationFinished(); 84 void setAnimationSpeed(float speed); 85 86 void initNPC(); 87 86 88 87 89 private: 90 91 typedef enum { 92 Walk, 93 Run, 94 Crouch, 95 Jump, 96 TurnTo, 97 LookAt, 98 TalkTo, 99 100 Shoot, 101 102 103 } AnimType; 104 105 typedef struct Anim 106 { 107 Vector v; 108 Quaternion q; 109 110 111 WorldEntity* entity; 112 float speed; 113 114 115 AnimType type; 116 }; 117 typedef std::list<GenericNPC::Anim> genNPCAnimList; 118 119 120 88 121 OrxSound::SoundSource soundSource; 89 122 OrxSound::SoundBuffer* soundBuffer; 90 123 float soundVolume; 91 124 125 std::list<GenericNPC::Anim> behaviourList; 92 126 Vector destCoor; 93 127 Quaternion destDir; … … 95 129 Animation3D* currentAnim; 96 130 float time; //!< Duration of the action 131 float fallVelocity; 97 132 }; 98 133
Note: See TracChangeset
for help on using the changeset viewer.