Example #1
0
 private float AdjustThrottleForFuel(float throttle)
 {
     if (_fuelTank != null)
     {
         var fuel = _fuelTank.DrainFuel(throttle * FullThrottleFuelConsumption);
         throttle = fuel * FullThrottleFuelConsumption;
     }
     return(throttle);
 }
Example #2
0
        // drain fuel from selected fuel tank
        private void EmptyFuel_Click(object sender, RoutedEventArgs e)
        {
            int amountOfFuel;

            if (!string.IsNullOrEmpty(FuelTankBox.Text) && int.TryParse(FuelTankBox.Text, out amountOfFuel) && !FuelTankBox.Text.Contains('-') && selectedFuelTank != null)
            {
                selectedFuelTank.DrainFuel(amountOfFuel);
                tankstelle.SaveFuelTanks();
                SelectFuelTank(selectedFuelTank);
                FuelTankBox.Text = "";
            }
        }
Example #3
0
    private float AdjustThrottleForFuel(float throttle)
    {
        float actualThrottle;

        if (FuelTank != null)
        {
            //TODO check why this is capped.
            var singleFrameConsumption = Math.Max(FullThrottleFuelConsumption * Time.fixedDeltaTime, 0.0001f);
            var desiredFuel            = throttle * singleFrameConsumption;
            var fuel = FuelTank.DrainFuel(desiredFuel);
            actualThrottle = fuel / singleFrameConsumption;
            //Debug.Log("Desired Throttle = " + throttle + ", actualThrottle: " + actualThrottle + ", DesiredFuel: " + desiredFuel + ", actual fuel: " + fuel);
        }
        else
        {
            actualThrottle = throttle;
        }
        return(actualThrottle);
    }