Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9003 in orxonox.OLD for trunk/src/world_entities/npcs/generic_npc.h


Ignore:
Timestamp:
Jul 2, 2006, 1:36:13 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the single_player_map branche back
merged with command:
svn merge -r8896:HEAD https://svn.orxonox.net/orxonox/branches/single_player_map .
no conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/npcs/generic_npc.h

    r8894 r9003  
    1010#include "npc.h"
    1111
    12 #include <string>
    1312
    1413#include "sound_source.h"
    15 
    16 #include "vector.h"
    17 #include "quaternion.h"
    18 
    1914
    2015namespace OrxSound{ class SoundSource; }
     
    2722class GenericNPC : public NPC
    2823{
     24
     25
    2926 public:
    30   GenericNPC();
    31   GenericNPC(const TiXmlElement* root);
     27  GenericNPC(const TiXmlElement* root = NULL);
    3228  virtual ~GenericNPC ();
    3329
    34   void init();
    3530  virtual void loadParams(const TiXmlElement* root);
    3631
    37   void setAnimation(int animationIndex, int animPlaybackMode);
    3832  /** sets the sound volume to @param vol: volume of the sound */
    3933  inline void setVolume(float vol) { this->soundVolume = vol; }
    4034
    4135
    42   /* npc controlling functions */
    4336
     37  bool finalGoalReached() { return this->behaviourList.empty(); };
     38
     39  /* npc controlling functions to be Queued */
    4440  /* 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);
    4943
    5044  /* 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);
    5447
    5548  /* 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);
    5951
    6052  /* stopping the movement */
    6153  void stop();
     54  void nextStep();
    6255
    6356  /* 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);
    6660
    6761  /* talking funcitons*/
    68   float talkTo(WorldEntity* worldEntity, int dialogNr);
     62  void talkTo(WorldEntity* worldEntity, int dialogNr);
    6963
    7064  /* shooting functions */
     
    7771  void playSound(int i);
    7872
    79   void setTime(float newTime){ this->time = newTime; };
    80  
    8173  virtual void tick (float time);
    8274
     
    8476  void destroy();
    8577
     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
    8688
    8789 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
    88121   OrxSound::SoundSource                   soundSource;
    89122   OrxSound::SoundBuffer*                  soundBuffer;
    90123   float                                   soundVolume;
    91124
     125   std::list<GenericNPC::Anim>             behaviourList;
    92126   Vector                                  destCoor;
    93127   Quaternion                              destDir;
     
    95129   Animation3D*                            currentAnim;
    96130   float                                   time;          //!< Duration of the action
     131   float                                   fallVelocity;
    97132};
    98133
Note: See TracChangeset for help on using the changeset viewer.