AirControl  1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
AirControl.AC_Airplane_Fuel Class Reference

Control fuel consumption More...

Inheritance diagram for AirControl.AC_Airplane_Fuel:
Collaboration diagram for AirControl.AC_Airplane_Fuel:

Public Member Functions

void InitFuel ()
 Initialize full to full capacity More...
 
void AddFuel (float aFuelAmount)
 Add fuel in case of mid airfueling facility More...
 
void ResetFuel ()
 Reset fuel in case of mid airfueling facility More...
 
void UpdateFuel (float aPrecentage)
 Fuel burnout calculations More...
 

Public Attributes

float fuelCapacity = 26f
 
float fuelBurnRate = 6.1f
 
UnityEvent onFuelFull = new UnityEvent()
 

Properties

float CurrentFuel [get]
 
float NormalizedFuel [get]
 

Detailed Description

Control fuel consumption

Definition at line 12 of file AC_Airplane_Fuel.cs.

Member Function Documentation

◆ AddFuel()

void AirControl.AC_Airplane_Fuel.AddFuel ( float  aFuelAmount)
inline

Add fuel in case of mid airfueling facility

Parameters
aFuelAmount

Definition at line 53 of file AC_Airplane_Fuel.cs.

54  {
55  currentFuel += aFuelAmount;
56  currentFuel = Mathf.Clamp(currentFuel, 0f, fuelCapacity);
57 
58  if(currentFuel >= fuelCapacity)
59  {
60  if(onFuelFull != null)
61  {
62  onFuelFull.Invoke();
63  }
64  }
65  }

◆ InitFuel()

void AirControl.AC_Airplane_Fuel.InitFuel ( )
inline

Initialize full to full capacity

Definition at line 45 of file AC_Airplane_Fuel.cs.

46  {
47  currentFuel = fuelCapacity;
48  }

◆ ResetFuel()

void AirControl.AC_Airplane_Fuel.ResetFuel ( )
inline

Reset fuel in case of mid airfueling facility

Definition at line 69 of file AC_Airplane_Fuel.cs.

70  {
71  currentFuel = fuelCapacity;
72  }

◆ UpdateFuel()

void AirControl.AC_Airplane_Fuel.UpdateFuel ( float  aPrecentage)
inline

Fuel burnout calculations

Parameters
aPrecentage

Definition at line 77 of file AC_Airplane_Fuel.cs.

78  {
79  float currentBurn = ((fuelBurnRate * aPrecentage) / 3600f) * Time.deltaTime;
80  currentFuel -= currentBurn;
81  currentFuel = Mathf.Clamp(currentFuel, 0f, fuelCapacity);
82  // Debug.Log("currentFuel -- "+currentFuel);
83 
84  normalizeFuel = currentFuel / fuelCapacity;
85  }

The documentation for this class was generated from the following file: