示例#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()}");
            }
        }