Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 9, 2019, 2:54:22 PM (5 years ago)
Author:
peterf
Message:

Improved formatting and added some comments to make the code more precise

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/3DPacman_FS19/src/modules/pacman/PacmanCyan.cc

    r12322 r12357  
    44#include "core/CoreIncludes.h"
    55#include "BulletDynamics/Dynamics/btRigidBody.h"
    6 
    7 
    86
    97        namespace orxonox{
     
    3937       
    4038        SUPER(PacmanGhost, tick, dt);
    41 
    4239        this->actuelposition = this->getPosition();
    43 
    44 
    4540
    4641        //Stop, if target arrived
     
    5146
    5247        //Move, if ghost hasn't arrived yet
    53         if(this->ismoving){
    54            
     48        if(this->ismoving){     
    5549            if(!(abs(this->actuelposition.z-target_z)<0.5)) {
    5650                velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z));
     
    6054                velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0);
    6155                move(dt, actuelposition, velocity);
    62             }
    63            
     56            }   
    6457        }
    6558
    6659        //Check on which position the ghost has arrived and set new target
    6760        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 
    7661            while(lockmove){};
    7762            lockmove = true;
     
    8671
    8772            }
    88             else if/*((!findpos(cyanPos, startPatrol))&&*/(this->passedByStart==false)/*)*/{
     73            else if(this->passedByStart==false){
    8974                //we have not even reached our startPatrol point
    9075
     
    9681                }
    9782            }
    98             else if/*((!findpos(cyanPos, goalPatrol))&&*/(this->passedByGoal==false)/*)*/{
     83            else if(this->passedByGoal==false){
    9984                //we have reached our startPatrol point, now we go to goalPoint
    10085
     
    11398
    11499            }
    115             else /*if(findpos(cyanPos, this->startPatrol))*/{
     100            else {
    116101                //we reached startPoint again. Either we change patrol
    117102                //or redo same patrol
     
    130115            }
    131116
    132 
    133 
    134 
    135117            lockmove=false; //NEVER FORGET THIS ONE !!!!!!!
    136118        }
     
    139121
    140122    void PacmanCyan::nextPatrol(){
    141 
    142123
    143124                int indexRand1=rand()%67;
     
    155136                }
    156137
    157 
    158 
    159 
    160138              this->startPatrol =  possibleposition[indexRand1];
    161139              this->goalPatrol = possibleposition[indexRand2];
    162 
    163               /*PatrolPosition startPatPol = PatrolPosition(startPatrol);
    164               PatrolPosition goalPatrol = PatrolPosition(goalPatrol);*/
    165140
    166141              this->passedByStart=false;
     
    180155        }
    181156
    182     /*struct PacmanCyan::PatrolPosition{
    183         //we need to check if PacmanCyan already passed the goal resp. start patrol point
    184 
    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 
    197157
    198158}
Note: See TracChangeset for help on using the changeset viewer.