GetAirlineValue() public method

public GetAirlineValue ( ) : AirlineValue
return AirlineValue
コード例 #1
0
        //returns the current price per share for an airline
        public static double GetPricePerAirlineShare(Airline airline)
        {
            var rnd = new Random();

            double price = 0;
            Airline.AirlineValue value = airline.GetAirlineValue();

            switch (value)
            {
                case Airline.AirlineValue.Low:
                    price = 15 + (rnd.NextDouble()*10);
                    break;
                case Airline.AirlineValue.VeryLow:
                    price = 5 + (rnd.NextDouble()*10);
                    break;
                case Airline.AirlineValue.Normal:
                    price = 25 + (rnd.NextDouble()*10);
                    break;
                case Airline.AirlineValue.High:
                    price = 40 + (rnd.NextDouble()*10);
                    break;
                case Airline.AirlineValue.VeryHigh:
                    price = 55 + (rnd.NextDouble()*10);
                    break;
            }

            return GeneralHelpers.GetInflationPrice(price);
        }
コード例 #2
0
        //returns if an airline can create a hub at an airport
        public static bool CanCreateHub(Airline airline, Airport airport, HubType type)
        {
            Terminal.TerminalType terminaltype = airline.AirlineRouteFocus == Route.RouteType.Cargo ? Terminal.TerminalType.Cargo : Terminal.TerminalType.Passenger;

            bool airlineHub = airport.GetHubs().Exists(h => h.Airline == airline);

            int airlineValue = (int) airline.GetAirlineValue() + 1;

            int totalAirlineHubs = airline.GetHubs().Count; // 'Airports.GetAllActiveAirports().Sum(a => a.Hubs.Count(h => h.Airline == airline));
            double airlineGatesPercent = Convert.ToDouble(airport.Terminals.GetNumberOfGates(airline))/Convert.ToDouble(airport.Terminals.GetNumberOfGates(terminaltype))*100;

            switch (type.Type)
            {
                case HubType.TypeOfHub.FocusCity:
                    return !airlineHub && airline.Money > AirportHelpers.GetHubPrice(airport, type);
                case HubType.TypeOfHub.RegionalHub:
                    return !airlineHub && airline.Money > AirportHelpers.GetHubPrice(airport, type) &&
                           (airport.Profile.Size == GeneralHelpers.Size.Large || airport.Profile.Size == GeneralHelpers.Size.Medium) && airport.GetHubs().Count < 7;
                case HubType.TypeOfHub.FortressHub:
                    return !airlineHub && airline.Money > AirportHelpers.GetHubPrice(airport, type) && (airport.Profile.Size > GeneralHelpers.Size.Medium) && airlineGatesPercent > 70 &&
                           (totalAirlineHubs < airlineValue);
                case HubType.TypeOfHub.Hub:
                    return !airlineHub && airline.Money > AirportHelpers.GetHubPrice(airport, type) && (airlineGatesPercent > 20) && (totalAirlineHubs < airlineValue) &&
                           (airport.GetHubs(HubType.TypeOfHub.Hub).Count < (int) airport.Profile.Size);
            }

            return false;
        }