- Timestamp:
- May 9, 2019, 2:54:22 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/3DPacman_FS19/src/modules/pacman/PacmanCyan.cc
r12322 r12357 4 4 #include "core/CoreIncludes.h" 5 5 #include "BulletDynamics/Dynamics/btRigidBody.h" 6 7 8 6 9 7 namespace orxonox{ … … 39 37 40 38 SUPER(PacmanGhost, tick, dt); 41 42 39 this->actuelposition = this->getPosition(); 43 44 45 40 46 41 //Stop, if target arrived … … 51 46 52 47 //Move, if ghost hasn't arrived yet 53 if(this->ismoving){ 54 48 if(this->ismoving){ 55 49 if(!(abs(this->actuelposition.z-target_z)<0.5)) { 56 50 velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z)); … … 60 54 velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0); 61 55 move(dt, actuelposition, velocity); 62 } 63 56 } 64 57 } 65 58 66 59 //Check on which position the ghost has arrived and set new target 67 60 else{ 68 69 std::cout<<startPatrol<<endl;70 std::cout<<goalPatrol<<endl;71 std::cout<<isPatrolling<<endl;72 std::cout<<this->actuelposition<<endl;73 std::cout<<this->passedByStart<<endl;74 std::cout<<this->passedByGoal<<endl;75 76 61 while(lockmove){}; 77 62 lockmove = true; … … 86 71 87 72 } 88 else if /*((!findpos(cyanPos, startPatrol))&&*/(this->passedByStart==false)/*)*/{73 else if(this->passedByStart==false){ 89 74 //we have not even reached our startPatrol point 90 75 … … 96 81 } 97 82 } 98 else if /*((!findpos(cyanPos, goalPatrol))&&*/(this->passedByGoal==false)/*)*/{83 else if(this->passedByGoal==false){ 99 84 //we have reached our startPatrol point, now we go to goalPoint 100 85 … … 113 98 114 99 } 115 else /*if(findpos(cyanPos, this->startPatrol))*/{100 else { 116 101 //we reached startPoint again. Either we change patrol 117 102 //or redo same patrol … … 130 115 } 131 116 132 133 134 135 117 lockmove=false; //NEVER FORGET THIS ONE !!!!!!! 136 118 } … … 139 121 140 122 void PacmanCyan::nextPatrol(){ 141 142 123 143 124 int indexRand1=rand()%67; … … 155 136 } 156 137 157 158 159 160 138 this->startPatrol = possibleposition[indexRand1]; 161 139 this->goalPatrol = possibleposition[indexRand2]; 162 163 /*PatrolPosition startPatPol = PatrolPosition(startPatrol);164 PatrolPosition goalPatrol = PatrolPosition(goalPatrol);*/165 140 166 141 this->passedByStart=false; … … 180 155 } 181 156 182 /*struct PacmanCyan::PatrolPosition{183 //we need to check if PacmanCyan already passed the goal resp. start patrol point184 185 public:186 187 Vector3 position;188 bool visitedPoint;189 190 PatrolPosition(Vector3 positionP){191 this->position=positionP;192 visitedPoint=false;193 }194 195 };*/196 197 157 198 158 }
Note: See TracChangeset
for help on using the changeset viewer.