Changeset 10045 in orxonox.OLD for branches/ai/src/world_entities
- Timestamp:
- Dec 12, 2006, 10:43:36 PM (18 years ago)
- Location:
- branches/ai/src/world_entities/npcs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ai/src/world_entities/npcs/npc_test.cc
r10041 r10045 37 37 38 38 39 NPC2::NPC2(const TiXmlElement* root) 40 : NPC(NULL) 39 NPC2::NPC2(const TiXmlElement* root) : NPC(NULL) 41 40 { 42 41 this->registerObject(this, NPC2::_objectList); 43 42 43 if (root != NULL)this->loadParams(root); 44 44 45 if (root != NULL)this->loadParams(root);46 47 45 addToTeam(0); 48 46 } … … 56 54 { 57 55 NPC::loadParams(root); 58 59 56 } 60 61 62 57 63 58 … … 65 60 void NPC2::tick(float dt) 66 61 { 67 68 69 // animating the md2 model (uninteressant) 62 // animating the md2 model 70 63 if( likely(this->getModel(0) != NULL)) 71 64 ((MD2Model*)this->getModel(0))->tick(dt); 72 73 return;74 //this things will now be managed by the AI modules..../////75 76 PRINTF(0)("====================\n");77 PRINTF(0)("NPC2::tick(%f)\n", dt);78 79 // information gathering80 81 Vector absPosition = this->getAbsCoor();82 83 PRINTF(0)(" npc abs coor: %f, %f, %f\n", absPosition.x, absPosition.y, absPosition.z);84 85 Player* pl = State::getPlayer();86 Vector playerAbsPos = pl->getPlayable()->getAbsCoor();87 88 PRINTF(0)(" player abs coor: %f, %f, %f\n", playerAbsPos.x, playerAbsPos.y, playerAbsPos.z);89 90 91 // intelligent reaction92 93 Vector distanceVector = playerAbsPos - absPosition;94 distanceVector.normalize();95 96 float speed = 10.0f;97 98 this->shiftCoor( distanceVector * speed * dt);99 100 101 102 65 } 103 66 -
branches/ai/src/world_entities/npcs/npc_test.h
r9947 r10045 14 14 NPC2 (const TiXmlElement* root); 15 15 virtual ~NPC2 (); 16 17 16 virtual void loadParams(const TiXmlElement* root); 18 19 20 17 virtual void tick(float dt); 21 18
Note: See TracChangeset
for help on using the changeset viewer.