Example #1
0
        public DrivableVehicle(VehicleDescription desc)
            : base(desc.ModelFile)
        {
            Descriptor = desc;
            float offset = VehicleWheel.Width / 2 - 0.1f;
            Wheels = new VehicleWheel[4];
            Wheels[0] = new VehicleWheel(this, _model.LeftFrontWheelPos, _model.FrontWheelSize, _model.WheelTexture, offset);
            Wheels[1] = new VehicleWheel(this, _model.RightFrontWheelPos, _model.FrontWheelSize, _model.WheelTexture, -offset);
            Wheels[2] = new VehicleWheel(this, _model.LeftRearWheelPos, _model.RearWheelSize, _model.WheelTexture, offset);
            Wheels[3] = new VehicleWheel(this, _model.RightRearWheelPos, _model.RearWheelSize, _model.WheelTexture, -offset);

            List<float> power = new List<float>(new float[] { 0.2f, 0.3f, 0.4f, 0.7f, 0.8f, 1.0f, 0.8f, 0.8f, 0.8f, 0.3f });
            List<float> ratios = new List<float>(new float[] { 3.827f, 2.360f, 1.685f, 1.312f, 1.000f, 0.793f });

            BaseGearbox gearbox = BaseGearbox.Create(GameConfig.ManualGearbox, ratios, 0.2f);
            Motor = new Motor(power, Descriptor.Horsepower, Descriptor.Redline, gearbox);
            Motor.Gearbox.GearChangeStarted += new EventHandler(Gearbox_GearChanged);
            _traction = (Motor.GetPowerAtRpmForGear(Motor.RedlineRpm, 2) * 30) - 30;

            BodyPitch = new Spring(1200, 1.5f, 200, 0, 1.4f);
            BodyRoll = new Spring(1200, 1.5f, 180, 0, 3);

            _audioProvider = new VehicleAudioProvider(this);
        }
Example #2
0
 public VehicleUIControl(VehicleDescription desc)
 {
     Descriptor = desc;
     QfsFile qfs = new QfsFile(@"Frontend\Art\Control\" + desc.UIImageFile);
     Bitmap = qfs.Content.Header.Bitmaps.Find(a => a.Id == "0000");
 }