Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/npcs/generic_npc.h

Last change on this file was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 2.8 KB
RevLine 
[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
[8793]12
[8516]13#include "sound_source.h"
[8514]14
[9061]15#include <stack>
16
17
[8516]18namespace OrxSound{ class SoundSource; }
19namespace OrxSound{ class SoundBuffer; }
[8514]20
21class TiXmlElement;
[8802]22class Animation3D;
[8514]23
24
25class GenericNPC : public NPC
26{
[9869]27  ObjectListDeclaration(GenericNPC);
[9003]28
29
[8514]30 public:
[9003]31  GenericNPC(const TiXmlElement* root = NULL);
[8514]32  virtual ~GenericNPC ();
33
34  virtual void loadParams(const TiXmlElement* root);
35
[8516]36  /** sets the sound volume to @param vol: volume of the sound */
37  inline void setVolume(float vol) { this->soundVolume = vol; }
[8514]38
[8705]39
40
[9061]41  bool finalGoalReached() { return this->behaviourList->empty(); };
[9003]42
43  /* npc controlling functions to be Queued */
[8894]44  /* walking functions */
[9003]45  void walkTo(const Vector& coordinate);
46  void walkTo(float x, float y, float z);
[8514]47
[8894]48  /* running functions */
[9003]49  void runTo(const Vector& coordinate);
50  void runTo(float x, float y, float z);
[8783]51
[8894]52  /* couching functinos */
[9003]53  void crouchTo(const Vector& coordinate);
54  void crouchTo(float x, float y, float z);
[8783]55
[8894]56  /* stopping the movement */
57  void stop();
[9061]58  void resume();
[9003]59  void nextStep();
[8894]60
61  /* some oriantation functions */
[9003]62  void lookAt(WorldEntity* worldEntity);
63  void turnTo(float qu, float qx, float qy, float qz);
64  void turnTo(float degreeInY);
[8894]65
66  /* talking funcitons*/
[9003]67  void talkTo(WorldEntity* worldEntity, int dialogNr);
[8783]68
[8894]69  /* shooting functions */
70  void shootAt(WorldEntity* entity);
[8793]71
[8514]72
[8894]73  /* some generic control funtions */
74  void playAnimation(int animationIndex, int animPlaybackMode);
[9061]75  void playSound(const std::string& filename);
[8894]76
[8514]77  virtual void tick (float time);
78
79
[9235]80  virtual void destroy(WorldEntity* killer);
[8894]81
[9003]82  private:
83    void init();
[8894]84
[9003]85    void setAnimation(int animationIndex, int animPlaybackMode);
86    int getAnimation();
87    bool isAnimationFinished();
88    void setAnimationSpeed(float speed);
89
90    void initNPC();
91
92
[8514]93 private:
[9003]94
95   typedef enum {
96    Walk,
97    Run,
98    Crouch,
99    Jump,
100    TurnTo,
101    LookAt,
102    TalkTo,
103
104    Shoot,
105
106
107   } AnimType;
108
109   typedef struct Anim
110   {
111     Vector        v;
112     Quaternion    q;
113
114
115     WorldEntity*  entity;
116     float         speed;
117
118
119     AnimType      type;
120   };
121   typedef std::list<GenericNPC::Anim>     genNPCAnimList;
122
123
124
[8516]125   OrxSound::SoundSource                   soundSource;
[9869]126   OrxSound::SoundBuffer                   soundBuffer;
[8516]127   float                                   soundVolume;
[8793]128
[9061]129   std::list<GenericNPC::Anim>*            behaviourList;
130   std::stack<std::list<GenericNPC::Anim>*> animationStack;
[8793]131   Vector                                  destCoor;
132   Quaternion                              destDir;
[8802]133
134   Animation3D*                            currentAnim;
[8894]135   float                                   time;          //!< Duration of the action
[9003]136   float                                   fallVelocity;
[8514]137};
138
139#endif /* _GENERIC_ENTITY_H */
Note: See TracBrowser for help on using the repository browser.