12 this->setShoot(
false);
13 this->maxSpeed = maxSpeed;
14 this->player = player;
15 this->setPos(point[aim]);
16 this->setSpeed(maxSpeed);
17 m_station_was_hit =
false;
25 m_station_was_hit =
true;
28 bool PoliceShip::behindPlayer()
31 return ( plane.
distance( this->getPos()) < 0);
35 if (m_station_was_hit || this->shipWasHitOnce())
40 Vector3 desiredView = playerPos - myPos;
41 float distance = desiredView.
length();
43 bool behind = this->behindPlayer();
44 float playerSpeed = player->
getSpeed();
46 float actualSpeed = this->getSpeed();
50 this->setSpeed(playerSpeed-0.005);
53 this->setSpeed(-playerSpeed-0.005);
57 if (distance >=6 && distance <= 8)
60 this->setSpeed( playerSpeed );
62 this->setSpeed( -playerSpeed );
65 if (distance > 8 && distance <= 15)
68 this->setSpeed(playerSpeed+0.005);
71 this->setSpeed(-playerSpeed+0.005);
74 if (distance > 15 && distance <= 250)
76 this->setSpeed( maxSpeed );
77 if (m_station_was_hit || this->shipWasHitOnce())
80 this->setShoot(
false);
85 if (m_station_was_hit || this->shipWasHitOnce())
88 this->setSpeed(maxSpeed);
93 this->setShoot(
false);
98 this->setView(desiredView); }
101 Vector3 directionToAim = point[aim] - this->getPos();
102 float distanceToAim = directionToAim.
length();
103 if (distanceToAim < 0.5)
106 if (aim >= point.size()) aim = 0;
107 directionToAim = point[aim] - this->getPos();
110 this->setView(directionToAim);