Changeset 10618 in orxonox.OLD for trunk/src/ai
- Timestamp:
- Apr 4, 2007, 12:13:53 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 16 16 OrxonoxPlayability.kdevses 17 17 OrxonoxPlayability.kdevelop.pcs 18 orxonox.backtrace 19 orxonox.kdevses 20 orxonox.kdevelop.pcs
-
- Property svn:ignore
-
trunk/src/ai
-
Property
svn:ignore
set to
Makefile.in
Makefile
.deps
*.a
-
Property
svn:ignore
set to
-
trunk/src/ai/swarm_attack.cc
r10376 r10618 30 30 void SwarmAttack::process(float dt) 31 31 { 32 std::map<WorldEntity*,AIModule*>::iterator it; 32 WorldEntity* taskRelObject = NULL; 33 if ( taskRelObjectName != "" ) 34 { 35 taskRelObject = dynamic_cast<WorldEntity*>(WorldEntity::objectList().getBaseObject( taskRelObjectName )); 36 37 38 std::map<WorldEntity*,AIModule*>::iterator it; 39 Vector sideL=taskRelPos.cross(Vector(0,1,0)).getNormalized(); 40 Vector sideR=sideL*-1; 41 Vector posL=Vector(0,0,0); 42 Vector posR=Vector(0,0,0); 43 33 44 34 Vector sideL=taskRelPos.cross(Vector(0,1,0)).getNormalized(); 35 Vector sideR=sideL*-1; 36 Vector posL=Vector(0,0,0);37 Vector posR=Vector(0,0,0);45 46 //tell positions to swarm-members... 47 float radius; 48 Vector objectPos=taskRelObject->getAbsCoor(); 38 49 39 //tell positions to swarm-members... 40 float radius; 41 Vector objectPos=taskRelObject->getAbsCoor(); 50 for (it=members.begin(); it!= members.end(); it++ ){ 51 radius=it->second->getNPCRadius(); 52 posR=posR+sideR*radius*1.5; 53 it->second->setDestination(objectPos+taskRelPos+posR); 54 it->second->setDestinationMovement(Vector(0,0,0)); 55 it->second->setTarget(taskRelObject); 56 it->second->process(dt); 57 posR=posR+sideR*radius*1.5; 42 58 43 for (it=members.begin(); it!= members.end(); it++ ){ 44 radius=it->second->getNPCRadius(); 45 posR=posR+sideR*radius*1.5; 46 it->second->setDestination(objectPos+taskRelPos+posR); 47 it->second->setDestinationMovement(Vector(0,0,0)); 48 it->second->setTarget(taskRelObject); 49 it->second->process(dt); 50 posR=posR+sideR*radius*1.5; 59 it++; 60 if(it==members.end())break; 61 radius=it->second->getNPCRadius(); 62 posL=posL+sideL*radius*1.5; 63 it->second->setDestination(objectPos+taskRelPos+posL); 64 it->second->setDestinationMovement(Vector(0,0,0)); 65 it->second->setTarget(taskRelObject); 66 it->second->process(dt); 67 posL=posL+sideL*radius*1.5; 68 } 51 69 52 it++; 53 if(it==members.end())break; 54 radius=it->second->getNPCRadius(); 55 posL=posL+sideL*radius*1.5; 56 it->second->setDestination(objectPos+taskRelPos+posL); 57 it->second->setDestinationMovement(Vector(0,0,0)); 58 it->second->setTarget(taskRelObject); 59 it->second->process(dt); 60 posL=posL+sideL*radius*1.5; 61 } 62 63 //check time.. 64 taskMaxTime-=dt; 65 if(taskMaxTime<0)taskComplete=true; 70 //check time.. 71 taskMaxTime-=dt; 72 if(taskMaxTime<0)taskComplete=true; 73 } 66 74 } -
trunk/src/ai/swarm_gorel.cc
r10376 r10618 48 48 Vector correction=Vector(0,0,0); 49 49 Vector destination; 50 51 WorldEntity* taskRelObject = NULL; 52 if ( taskRelObjectName != "" ) 53 taskRelObject = dynamic_cast<WorldEntity*>(WorldEntity::objectList().getBaseObject( taskRelObjectName )); 50 54 51 55 if(taskRelObject!=NULL && taskMaxTime>0){ -
trunk/src/ai/swarm_module.h
r10376 r10618 24 24 inline void orderView(Vector taskView){this->taskView=taskView;} 25 25 inline void orderSpeed(float taskSpeed){this->taskSpeed=taskSpeed;} 26 inline void orderRelObject(WorldEntity* taskRelObject){ this->taskRelObject=taskRelObject;}26 inline void orderRelObject(WorldEntity* taskRelObject){if (taskRelObject) this->taskRelObjectName=taskRelObject->getName(); else taskRelObjectName = ""; } 27 27 inline void orderMaxTime(float taskMaxTime){this->taskMaxTime=taskMaxTime;} 28 28 … … 44 44 Vector taskView; 45 45 float taskSpeed; 46 WorldEntity* taskRelObject;46 std::string taskRelObjectName; 47 47 bool taskComplete; 48 48 float taskMaxTime; -
trunk/src/ai/swarm_wait.cc
r10555 r10618 19 19 void SwarmWait::process(float dt) 20 20 { 21 if(taskRelObject!=NULL){ 22 Vector distVect=taskRelObject->getAbsCoor()-getSwarmPosition(); 23 float distance=distVect.len(); 24 if(distance<attackDistance+100)taskComplete=true; //### change wakeup distance here 21 if(taskRelObjectName!=""){ 22 WorldEntity* taskRelObject = dynamic_cast<WorldEntity*>(WorldEntity::objectList().getBaseObject( taskRelObjectName )); 23 Vector distVect=taskRelObject->getAbsCoor()-getSwarmPosition(); 24 float distance=distVect.len(); 25 if(distance<attackDistance+100)taskComplete=true; //### change wakeup distance here 25 26 } 26 27
Note: See TracChangeset
for help on using the changeset viewer.