9 #define min(a,b) (((a) < (b)) ? (a) : (b))
14 this->player = player;
15 this->maxSpeed = maxSpeed;
22 bool Pirate::behindPlayer()
25 return ( plane.
distance( this->getPos()) < 0);
33 Vector3 desiredView = playerPos - myPos;
34 float distance = desiredView.
length();
36 bool behind = this->behindPlayer();
37 float playerSpeed = player->
getSpeed();
39 float actualSpeed = this->getSpeed();
43 this->setSpeed(playerSpeed-0.005);
46 this->setSpeed(-playerSpeed-0.005);
50 if (distance >=6 && distance <= 8)
53 this->setSpeed( playerSpeed );
55 this->setSpeed( -playerSpeed );
58 if (distance > 8 && distance <= 15)
61 this->setSpeed(playerSpeed+0.005);
64 this->setSpeed(-playerSpeed+0.005);
67 if (distance > 15 && distance <= 250)
69 this->setSpeed( maxSpeed );
70 if (this->shipWasHitOnce())
73 this->setShoot(
false);
78 if (this->shipWasHitOnce())
81 this->setSpeed(maxSpeed);
86 this->setShoot(
false);
91 this->setView(desiredView);