Пример #1
0
        public VehicleTrafficGenerator(Roadway ra, int systemSpeedFactor = 1)
        {
            _vgTimer.Interval = 1000 / systemSpeedFactor;

            _vg = new VehicleGenerator();

            _ra = ra;

            Init();
        }
Пример #2
0
        public void OnLightChanged(ConsoleColor cc)
        {
            //Console.WriteLine("vehicles can move...");

            //for now... no limit the number of vehicles spawned...
            //SpawnVehicles();
            int numV = _vgRandom.Next(0, 3);

            while (numV-- > 0)
            {
                _ra.DrivenOnBy(VehicleGenerator.Create());
                Console.ForegroundColor = ConsoleColor.Gray;
                Console.WriteLine($" - drove up: {_ra.RoadwayVehicles.Last()}");
            }
        }