Changeset 10349 in orxonox.OLD for branches/ai/src/ai/ai_team.cc
- Timestamp:
- Jan 24, 2007, 6:55:21 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ai/src/ai/ai_team.cc
r10290 r10349 30 30 31 31 if(it->second->taskDone()){ 32 std::cout << "Swarm Task Complete!\n";32 //std::cout << "Swarm Task Complete!\n"; 33 33 34 34 if(enemyList->size()==0){ … … 51 51 //find new Position 52 52 if(isPlayer){ 53 float attackDistance=it->second->getAttackDistance(); 54 53 55 Vector targetPos=target->getAbsCoor(); 54 56 int zNorm=(position.z>targetPos.z)?1:-1; 55 57 56 58 if((position.z-targetPos.z)*zNorm>60){ //go to start position 57 std::cout << "Go Start Position\n";59 //std::cout << "Go Start Position\n"; 58 60 changeSwarmModule(it, new SwarmGoRel); 59 61 zNorm=1-(rand()%2)*2; //1 or -1 60 newPosition=Vector( 190,0,zNorm*10);62 newPosition=Vector(attackDistance+60,0,zNorm*10); 61 63 speed=60; 62 }else if(position.x > targetPos.x+ 160){ //go to attack position63 std::cout << "Go Attack Position\n";64 }else if(position.x > targetPos.x+attackDistance+40){ //go to attack position 65 //std::cout << "Go Attack Position\n"; 64 66 changeSwarmModule(it, new SwarmGoRel); 65 newPosition=Vector( 130,0,0);67 newPosition=Vector(attackDistance+30,0,0); 66 68 speed=60; 67 }else if(position.x > targetPos.x+ 120){ //go to attack mode68 std::cout << "Go Attack Mode\n";69 }else if(position.x > targetPos.x+attackDistance+20){ //go to attack mode 70 //std::cout << "Go Attack Mode\n"; 69 71 changeSwarmModule(it, new SwarmAttack); 70 newPosition=Vector( 110,0,0);72 newPosition=Vector(attackDistance,0,0); 71 73 speed=60; 72 74 maxTime=(rand()%11)+4;//4-14 Sekunden 73 75 }else{ //go to fallback point 74 std::cout << "Go Fallback Point\n";76 //std::cout << "Go Fallback Point\n"; 75 77 changeSwarmModule(it, new SwarmGoRel); 76 78 newPosition=Vector(80,0,zNorm*90); … … 106 108 107 109 108 void AITeam::addAI(int swarmNumber, WorldEntity* npc )110 void AITeam::addAI(int swarmNumber, WorldEntity* npc, float maxSpeed, float attackDistance) 109 111 { 110 112 std::pair<std::map<int,SwarmModule*>::iterator,bool> p; … … 112 114 p=swarms.insert(std::make_pair(swarmNumber,newSwarm)); 113 115 if(!p.second)delete newSwarm; 114 p.first->second->addAI(npc );116 p.first->second->addAI(npc, maxSpeed, attackDistance); 115 117 } 116 118
Note: See TracChangeset
for help on using the changeset viewer.