Exemplo n.º 1
0
    void ManageFutureFlights(float deltaTime)
    {
        timeSinceManageFlight += deltaTime;

        // test if we have waited for 2 seconds yet
        if (timeSinceManageFlight >= waitSecondsManageFutureFlights)
        {
            timeSinceManageFlight = 0;
        }
        else
        {
            return;
        }

        // loop through all future flights and see if they can now work
        FutureFlight createFlight = null;

        foreach (FutureFlight futureFlight in futureFlights)
        {
            // if no road correction, don't bother looking for path
            if (ReadyForFlightCreation(futureFlight.parkingSpot, futureFlight))
            {
                createFlight = futureFlight;
                break;
            }
        }

        if (createFlight != null)
        {
            CreateFlight(createFlight);
            futureFlights.Remove(createFlight);
        }
    }
Exemplo n.º 2
0
    /*
     *	Create a new flight and add to flight list
     */
    void CreateFlight(FutureFlight futureFlight)
    {
        Runway curRunway = airport.runwayList[0];         // very temporary, need to able to chose runway

        // create flight and add to list
        Flight newFlight = new Flight(futureFlight.gate, futureFlight.parkingSpot, curRunway,
                                      secondsDelayBeforeExit, secondsSeparation, secondsVariation,
                                      minutesToBoarding, minutesBoarding, this);

        CreateFlightFinal(newFlight, curRunway);
    }
    /*
     *	Create a new flight and add to flight list
     */
    void CreateFlight(FutureFlight futureFlight)
    {
        Runway curRunway = airport.runwayList[0]; // very temporary, need to able to chose runway

        // create flight and add to list
        Flight newFlight = new Flight(futureFlight.gate, futureFlight.parkingSpot, curRunway,
            secondsDelayBeforeExit, secondsSeparation, secondsVariation,
            minutesToBoarding, minutesBoarding, this);

        CreateFlightFinal(newFlight, curRunway);
    }
Exemplo n.º 4
0
    /*
     *	Test if all the conditions are verified so that passengers and airplanes can be spawned
     *	in the form of a Flight being created
     */
    bool ReadyForFlightCreation(PathfindingObject pathObject, FutureFlight futureFlight)
    {
        // test if the parking spot has a road connection
        if (!futureFlight.parkingSpot.HasRoadConnection())
        {
            return(false);
        }
        // test if runways are reachable
        else if (!AreRunwaysReachable(futureFlight.parkingSpot))
        {
            return(false);
        }
        // test if there are entrances
        else if (airport.GetAllEntrances().Count < 1)
        {
            return(false);
        }

        return(true);
    }
Exemplo n.º 5
0
    /* ----------------------------------- static methods -----------------------------------
     * /*
     *	When a parking spot is build (connected to gate) this function will
     *  add the flight to the futureFlightList so it can be tested for validity
     */
    public static void FlightSpotAvailable(Gate gate, ParkingSpot parking_spot)
    {
        FutureFlight futureFlight = new FutureFlight(gate, parking_spot);

        futureFlights.Add(futureFlight);
    }
 /* ----------------------------------- static methods -----------------------------------
 /*
  *	When a parking spot is build (connected to gate) this function will
  * 	add the flight to the futureFlightList so it can be tested for validity
  */
 public static void FlightSpotAvailable(Gate gate, ParkingSpot parking_spot)
 {
     FutureFlight futureFlight = new FutureFlight(gate, parking_spot);
     futureFlights.Add(futureFlight);
 }
    /*
     *	Test if all the conditions are verified so that passengers and airplanes can be spawned
     *	in the form of a Flight being created
     */
    bool ReadyForFlightCreation(PathfindingObject pathObject, FutureFlight futureFlight)
    {
        // test if the parking spot has a road connection
        if (!futureFlight.parkingSpot.HasRoadConnection()) {
            return false;
        }
        // test if runways are reachable
        else if (!AreRunwaysReachable(futureFlight.parkingSpot)) {
            return false;
        }
        // test if there are entrances
        else if (airport.GetAllEntrances().Count < 1)
            return false;

        return true;
    }