Changeset 10440 in orxonox.OLD for trunk/src/world_entities/npcs
- Timestamp:
- Jan 28, 2007, 2:09:09 PM (18 years ago)
- Location:
- trunk/src/world_entities/npcs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/npcs/npc.cc
r10439 r10440 34 34 #include "debug.h" 35 35 #include "loading/load_param.h" 36 #include "util/loading/load_param_xml.h" 36 37 #include "track/track.h" 37 38 … … 58 59 59 60 this->toList(OM_GROUP_01); 61 this->bAIEnabled = false; 60 62 61 63 if( root != NULL) 62 this->loadParams(root); 63 64 std::cout << "Team Number: " << teamNumber << "\n"; 65 std::cout << "Swarm Number:" << swarmNumber << "\n"; 66 67 //add to track 68 if(this->entityTrack) 69 this->setParent(this->entityTrack->getTrackNode()); 70 else 71 AIEngine::getInstance()->addAI(teamNumber,swarmNumber,(WorldEntity*)this,maxSpeed,attackDistance); 64 this->loadParams(root); 65 66 if( this->bAIEnabled) 67 { 68 std::cout << "Team Number: " << teamNumber << "\n"; 69 std::cout << "Swarm Number:" << swarmNumber << "\n"; 70 71 if( this->entityTrack) 72 this->setParent(this->entityTrack->getTrackNode()); 73 else 74 AIEngine::getInstance()->addAI(teamNumber,swarmNumber,(WorldEntity*)this,maxSpeed,attackDistance); 75 } 72 76 73 77 this->bFire = false; … … 123 127 124 128 125 129 126 130 127 131 } … … 144 148 WorldEntity::loadParams(root); 145 149 150 LoadParam(root, "enableAI", this, NPC, enableAI) 151 .describe("enables the AI algorithms"); 152 146 153 LoadParam(root, "team", this, NPC, setTeamNumber) 147 154 .describe("this sets the team number") … … 159 166 .describe("this sets the NPC distance to target") 160 167 .defaultValues(0); 168 169 170 // Track 171 LoadParamXML(root, "Weapons", this, NPC, addWeapons) 172 .describe("creates and adds weapons"); 173 } 174 175 176 void NPC::addWeapons(const TiXmlElement* root) 177 { 178 if( root == NULL) 179 return; 180 181 LOAD_PARAM_START_CYCLE(root, element); 182 { 183 PRINTF(0)("got weapon: %s\n", element->Value()); 184 BaseObject* obj = Factory::fabricate(element); 185 if( obj != NULL && obj->isA( Weapon::staticClassID())) 186 { 187 PRINTF(0)("created a weapon\n"); 188 } 189 } 190 LOAD_PARAM_END_CYCLE(element); 161 191 } 162 192 -
trunk/src/world_entities/npcs/npc.h
r10376 r10440 20 20 21 21 22 void addWeapons(const TiXmlElement* root); 22 23 bool addWeapon(Weapon* weapon, int configID = -1, int slotID = -1); 23 24 void removeWeapon(Weapon* weapon); … … 31 32 inline void fire(){ this->bFire=true;} 32 33 33 34 inline void enableAI() { this->bAIEnabled = true; } 34 35 35 36 private: … … 51 52 52 53 AIModule* aiModule; 54 55 bool bAIEnabled; //!< true is AI enabled 53 56 }; 54 57
Note: See TracChangeset
for help on using the changeset viewer.