| Last change
                  on this file since 1406 was
                  859,
                  checked in by landauf, 18 years ago | 
        
          | 
more or less a copy of the trunk
 | 
        | File size:
            1.3 KB | 
      
      
        
  | Rev | Line |  | 
|---|
| [859] | 1 | /** | 
|---|
|  | 2 | @file NPC.h | 
|---|
|  | 3 | @brief AI using WorldEntity | 
|---|
|  | 4 | @author Benjamin Knecht <beni_at_orxonox.net> | 
|---|
|  | 5 | */ | 
|---|
|  | 6 |  | 
|---|
|  | 7 | #ifndef _NPC_H__ | 
|---|
|  | 8 | #define _NPC_H__ | 
|---|
|  | 9 |  | 
|---|
|  | 10 | #include "../OrxonoxPrereqs.h" | 
|---|
|  | 11 |  | 
|---|
|  | 12 | #include "Model.h" | 
|---|
|  | 13 |  | 
|---|
|  | 14 | class TiXmlElement; // Forward declaration | 
|---|
|  | 15 |  | 
|---|
|  | 16 | namespace orxonox { | 
|---|
|  | 17 |  | 
|---|
|  | 18 | class _OrxonoxExport NPC : public Model | 
|---|
|  | 19 | { | 
|---|
|  | 20 | public: | 
|---|
|  | 21 |  | 
|---|
|  | 22 | NPC(); | 
|---|
|  | 23 | virtual ~NPC(); | 
|---|
|  | 24 | virtual void loadParams(TiXmlElement* xmlElem); | 
|---|
|  | 25 | void tick(float dt); | 
|---|
|  | 26 | void update(); | 
|---|
|  | 27 | void setValues(Vector3 location, Vector3 speed, Vector3 acceleration, bool movable); | 
|---|
|  | 28 |  | 
|---|
|  | 29 | private: | 
|---|
|  | 30 | float getDistance(WorldEntity* temp); | 
|---|
|  | 31 | void calculateAcceleration(); | 
|---|
|  | 32 | Vector3 separation(); | 
|---|
|  | 33 | Vector3 alignment(); | 
|---|
|  | 34 | Vector3 cohesion(); | 
|---|
|  | 35 |  | 
|---|
|  | 36 |  | 
|---|
|  | 37 | private: | 
|---|
|  | 38 | bool movable_;  // movability of the element, (false) gives the possiblity that an object can`t be moved by flocking but still gets into the calculation | 
|---|
|  | 39 |  | 
|---|
|  | 40 | // those values should maybe be controlled by a higher power and should maybe be parameters that can be changed | 
|---|
|  | 41 | static int const SEPERATIONDISTANCE = 300;  //detectionradius of seperation | 
|---|
|  | 42 | static int const ALIGNMENTDISTANCE = 300;  //detectionradius of alignment | 
|---|
|  | 43 | static int const COHESIONDISTANCE = 5000;  //detectionradius of cohesion | 
|---|
|  | 44 | static int const NUMELEMENTS = 9;  //number of elements | 
|---|
|  | 45 | }; | 
|---|
|  | 46 | ExportClass(NPC, Orxonox); | 
|---|
|  | 47 |  | 
|---|
|  | 48 | } | 
|---|
|  | 49 | #endif /* _NPC_H__ */ | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.