Exemplo n.º 1
0
        /// <summary>
        /// Getting the lowest cost possible for this particular trip
        /// </summary>
        /// <param name="origin">The origin of the trip</param>
        /// <param name="destination">The destination of the trip</param>
        /// <param name="time"></param>
        /// <returns>The lowest cost</returns>
        public float Cost(IZone origin, IZone destination, Time time)
        {
            int[] stations = TransitAccessData.ClosestStations(origin);

            float minCost    = float.MaxValue;
            var   auto       = TashaRuntime.AutoMode;
            var   zoneSystem = TashaRuntime.ZoneSystem;

            for (int i = 0; i < stations.Length; i++)
            {
                var   stationZone = zoneSystem.Get(stations[i]);
                float cost        = auto.Cost(origin, stationZone, time)
                                    + TransitAccessData.Station(stationZone).ParkingCost;
                if (cost < minCost)
                {
                    minCost = cost;
                }
            }

            return(minCost);
        }