Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 29, 2006, 3:30:20 PM (18 years ago)
Author:
bensch
Message:

orxonox/sp: begin new GenNPC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/world_entities/npcs/generic_npc.h

    r8894 r8908  
    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
     
    4035
    4136
    42   /* npc controlling functions */
    4337
     38  bool finalGoalReached() const { return this->behaviourList.empty(); };
     39
     40  /* npc controlling functions to be Queued */
    4441  /* 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);
     42  void walkTo(const Vector& coordinate);
     43  void walkTo(float x, float y);
     44  void walkTo(float x, float y, float z);
    4945
    5046  /* 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);
     47  void runTo(const Vector& coordinate);
     48  void runTo(float x, float y);
     49  void runTo(float x, float y, float z);
    5450
    5551  /* 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);
     52  void crouchTo(const Vector& coordinate);
     53  void crouchTo(float x, float y);
     54  void crouchTo(float x, float y, float z);
    5955
    6056  /* stopping the movement */
     
    6258
    6359  /* some oriantation functions */
    64   float lookAt(WorldEntity* worldEntity);
    65   bool turnTo(float qu, float qx, float qy, float qz);
     60  void lookAt(WorldEntity* worldEntity);
     61  void turnTo(float qu, float qx, float qy, float qz);
     62  void turnTo(float degreeInY);
    6663
    6764  /* talking funcitons*/
    68   float talkTo(WorldEntity* worldEntity, int dialogNr);
     65  void talkTo(WorldEntity* worldEntity, int dialogNr);
    6966
    7067  /* shooting functions */
     
    7774  void playSound(int i);
    7875
    79   void setTime(float newTime){ this->time = newTime; };
    80  
    8176  virtual void tick (float time);
    8277
     
    8479  void destroy();
    8580
     81  private:
     82    void init();
     83
    8684
    8785 private:
     86
     87   typedef enum {
     88    Walk,
     89    Run,
     90    Crouch,
     91    Jump,
     92    TurnTo,
     93    LookAt,
     94    TalkTo,
     95
     96    Shoot,
     97
     98
     99   } AnimType;
     100
     101   typedef struct Anim
     102   {
     103     Anim();
     104
     105     Vector        v;
     106     Quaternion    q;
     107
     108
     109     WorldEntity*  entity;
     110     float         speed;
     111
     112
     113     AnimType      type;
     114   };
     115   typedef std::list<GenericNPC::Anim>     genNPCAnimList;
     116
     117
     118
    88119   OrxSound::SoundSource                   soundSource;
    89120   OrxSound::SoundBuffer*                  soundBuffer;
    90121   float                                   soundVolume;
    91122
     123   std::list<GenericNPC::Anim>             behaviourList;
    92124   Vector                                  destCoor;
    93125   Quaternion                              destDir;
Note: See TracChangeset for help on using the changeset viewer.