Пример #1
0
Vector3 UnitAiMoonGuard::avoidPlanets(const WorldInterface& world, const Vector3& originalVelocity)
{
    PhysicsObjectId planetoid_id = world.getNearestPlanetoidId(getShip().getPosition());
    Vector3         planetoid_center = world.getPosition(planetoid_id);
    double          planetoid_radius = world.getRadius(planetoid_id);
    return m_steering_behaviour.avoid(world,
                                      originalVelocity,
                                      planetoid_center,
                                      planetoid_radius,
                                      PLANETOID_CLEARANCE,
                                      PLANETOID_AVOID_DISTANCE);
}
Пример #2
0
void UnitAiMoonGuard::scan(const WorldInterface& world)
{
    scanCount++;
    if (scanCount == SCAN_COUNT_MAX)
    {
        //printf("Scanning...\n");
        Vector3 ship_pos = getShip().getPosition();

        nearbyShips = world.getShipIds(ship_pos, SCAN_DISTANCE_SHIP);
        getClosestShip(world);
        getClosestEnemyShip(world);

        Vector3 position = ship_pos + (getShip().getForward() * 500.f);
        nearbyRingParticles = world.getRingParticles(position, SCAN_DISTANCE_RING_PARTICLE);

        nearestPlanetoid = world.getNearestPlanetoidId(ship_pos);

        scanCount = 0;
    }
}