Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/single_player_map/src/world_entities/npcs/generic_npc.h @ 8823

Last change on this file since 8823 was 8823, checked in by snellen, 18 years ago

added setTime function

File size: 2.5 KB
Line 
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>
13
14#include "sound_source.h"
15
16#include "vector.h"
17#include "quaternion.h"
18
19
20namespace OrxSound{ class SoundSource; }
21namespace OrxSound{ class SoundBuffer; }
22
23class TiXmlElement;
24class Animation3D;
25
26
27class GenericNPC : public NPC
28{
29 public:
30  GenericNPC();
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);
38  /** sets the sound volume to @param vol: volume of the sound */
39  inline void setVolume(float vol) { this->soundVolume = vol; }
40
41
42  /* npc controlling functions */
43
44  /* 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);
49
50  /* 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);
54
55  /* 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);
59
60  /* stopping the movement */
61  void stop();
62
63  /* some oriantation functions */
64  float lookAt(WorldEntity* worldEntity);
65
66  /* talking funcitons*/
67  float talkTo(WorldEntity* worldEntity, int dialogNr);
68
69  /* shooting functions */
70  void shootAt(WorldEntity* entity);
71
72
73  /* some generic control funtions */
74  void playAnimation(int animationIndex, int animPlaybackMode);
75  void playSound(std::string filename);
76  void playSound(int i);
77
78  void setTime(float newTime){ this->time = newTime; };
79 
80  virtual void tick (float time);
81
82
83  void destroy();
84
85 private:
86   OrxSound::SoundSource                   soundSource;
87   OrxSound::SoundBuffer*                  soundBuffer;
88   float                                   soundVolume;
89
90   Vector                                  destCoor;
91   Quaternion                              destDir;
92
93   Animation3D*                            currentAnim;
94   float                                   time;          //!< Duration of the action
95};
96
97#endif /* _GENERIC_ENTITY_H */
Note: See TracBrowser for help on using the repository browser.