Changeset 10135 in orxonox.OLD for branches/ai/src/world_entities
- Timestamp:
- Dec 20, 2006, 7:47:45 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
r10112 r10135 19 19 20 20 #include "npc_test.h" 21 21 #include <stdio.h> 22 22 23 23 #include "state.h" … … 34 34 #include "movement_module.h" 35 35 #include "ai_module.h" 36 36 #include "ai_team.h" 37 #include "ai_swarm.h" 38 #include "ai_engine.h" 37 39 38 40 ObjectListDefinitionID(NPC2, CL_NPC_TEST2); … … 43 45 { 44 46 this->registerObject(this, NPC2::_objectList); 45 if (root != NULL)this->loadParams(root); 46 47 this->aiModule=new MovementModule(this); 47 48 if (root != NULL) 49 this->loadParams(root); 50 51 std::cout << "Team Number: " << teamNumber << "\n"; 52 std::cout << "Swarm Number:" << swarmNumber << "\n"; 53 54 AITeam* myTeam=AIEngine::getInstance()->getCreateTeam(teamNumber); 55 //std::cout << "Testpoint 4: " << myTeam << "\n"; 56 AISwarm* mySwarm=myTeam->getCreateSwarm(swarmNumber); 57 //std::cout << "Testpoint 5: " << mySwarm << "\n"; 58 mySwarm->addToSwarm(new MovementModule(this)); 59 48 60 } 49 61 50 51 NPC2::~NPC2 ()52 {}53 62 54 63 … … 56 65 { 57 66 NPC::loadParams(root); 67 68 LoadParam(root, "team", this, NPC2, setTeamNumber) 69 .describe("this sets the team number") 70 .defaultValues(0); 71 72 LoadParam(root, "swarm", this, NPC2, setSwarmNumber) 73 .describe("this sets the swarm number") 74 .defaultValues(0); 58 75 } 59 76 … … 65 82 if( likely(this->getModel(0) != NULL) && this->getModel(0)->isA(MD2Model::staticClassID())) 66 83 ((MD2Model*)this->getModel(0))->tick(dt); 67 68 // processing AI69 //PRINTF(0)("Processing NPC\n");70 if(this->aiModule!=NULL)this->aiModule->process(dt);71 84 } 72 85 -
branches/ai/src/world_entities/npcs/npc_test.h
r10112 r10135 11 11 12 12 class NPC2 : public NPC { 13 13 ObjectListDeclaration(NPC2); 14 14 15 16 17 virtual ~NPC2 ();18 19 15 public: 16 NPC2 (const TiXmlElement* root); 17 virtual ~NPC2 (){}; 18 virtual void loadParams(const TiXmlElement* root); 19 virtual void tick(float dt); 20 20 21 int team; 22 int swarm; 23 int difficulty; 24 AIModule* aiModule; 21 22 private: 23 inline void setTeamNumber(int number){teamNumber=number;} 24 inline void setSwarmNumber(int number){swarmNumber=number;} 25 26 int teamNumber; 27 int swarmNumber; 28 int difficulty; 29 30 AIModule* aiModule; 25 31 }; 26 32
Note: See TracChangeset
for help on using the changeset viewer.