示例#1
0
文件: Race.cs 项目: STPKITT/OpenNFS1
 public Race(int nbrLaps, Track track, PlayerDriver player)
 {
     _nbrLaps = nbrLaps;
     Player = player;
     Track = track;
     PlayerStats = new PlayerRaceStats();
     Drivers = new List<IDriver>();
     AddDriver(player);
     if (track.Description.IsOpenRoad)
     {
         _trafficController = new TrafficController(this);
     }
 }
示例#2
0
        public DoRaceScreen(Track track)
        {
            _track = track;
            _car = new DrivableVehicle(GameConfig.SelectedVehicle);

            _playerDriver = new PlayerDriver(_car);
            _car.AudioEnabled = true;

            _race = new Race(_track.IsOpenRoad ? 1 : 3, _track, _playerDriver);
            for (int i = 0; i < 10; i++)
            {
                int j = Engine.Instance.Random.Next(VehicleDescription.Descriptions.Count);
                _race.AddDriver(new RacingAIDriver(VehicleDescription.Descriptions[j]));
            }
                //_race.AddDriver(new AIDriver(VehicleDescription.Descriptions.Find(a => a.Name == "Viper")));
                //_race.AddDriver(new AIDriver(VehicleDescription.Descriptions.Find(a => a.Name == "Viper")));
                //_race.AddDriver(new AIDriver(VehicleDescription.Descriptions.Find(a => a.Name == "Viper")));
                //_race.AddDriver(new AIDriver(VehicleDescription.Descriptions.Find(a => a.Name == "Viper")));
                _playerUI = new PlayerUI(_car);
            /*
            d = new AIDriver(VehicleDescription.Descriptions.Find(a => a.Name == "911"));
            _aiDrivers.Add(d);
            _track.AddDriver(d);
            d = new AIDriver(VehicleDescription.Descriptions.Find(a => a.Name == "Viper"));
            _aiDrivers.Add(d);
            _track.AddDriver(d);
            d = new AIDriver(VehicleDescription.Descriptions.Find(a => a.Name == "Diablo"));
            _aiDrivers.Add(d);
            _track.AddDriver(d);
            d = new AIDriver(VehicleDescription.Descriptions.Find(a => a.Name == "F512"));
            _aiDrivers.Add(d);
            _track.AddDriver(d);
            d = new AIDriver(VehicleDescription.Descriptions.Find(a => a.Name == "ZR1"));
            _aiDrivers.Add(d);
            _track.AddDriver(d);
            d = new AIDriver(VehicleDescription.Descriptions.Find(a => a.Name == "NSX"));
            _aiDrivers.Add(d);
            _track.AddDriver(d);
            */

            _raceUI = new RaceUI(_race);
            _race.StartCountdown();

            _raceViewport = new Viewport(0, 0, 640, 400);
            _uiViewport = new Viewport(0, 0, 640, 480);
        }