コード例 #1
0
ファイル: DoRaceScreen.cs プロジェクト: slasher79/OpenNFS1
        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);
        }
コード例 #2
0
ファイル: DoRaceScreen.cs プロジェクト: STPKITT/OpenNFS1
        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);
        }