Пример #1
0
        public bool AutoDrift;          //used for ai racers

        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);
        }
Пример #2
0
 public Motor(List<float> powerCurve, float maxPower, float redline, BaseGearbox gearbox)
 {
     _powerCurve = powerCurve;
     _maxPower = maxPower;
     _redlineRpm = redline;
     _gearbox = gearbox;
     _gearbox.Motor = this;
 }
Пример #3
0
 public Motor(List <float> powerCurve, float maxPower, float redline, BaseGearbox gearbox)
 {
     _powerCurve    = powerCurve;
     _maxPower      = maxPower;
     _redlineRpm    = redline;
     _gearbox       = gearbox;
     _gearbox.Motor = this;
 }