Class AircraftFuelManager
Centralized fuel system manager that tracks fuel tanks, monitors consumption, and distributes fuel to consumers based on tank selection settings.
Namespace: NWH.Aerodynamics.AircraftController.Fuel
Assembly: NWH.Aerodynamics.dll
Syntax
public class AircraftFuelManager : MonoBehaviour
Remarks
Automatically discovers all fuel tanks and consumers on the aircraft. Supports two modes: selective (specific tank) or balanced (all tanks equally). As fuel is consumed, the system updates total available fuel and affects aircraft weight/balance through the VariableCenterOfMass system. Triggers OnOutOfFuel event when selected tanks are depleted.
Fields
| Edit this page View SourceOnOutOfFuel
Event triggered when the selected fuel tank(s) are depleted. Use for engine shutdown, warnings, or emergency procedures.
Declaration
[Tooltip("Invoked when selected fuel tank(s) run out of fuel.")]
public UnityEvent OnOutOfFuel
Field Value
| Type | Description |
|---|---|
| UnityEvent |
consumers
All fuel consumers on this aircraft. Automatically populated on Awake.
Declaration
[Tooltip("List of aircraft fuel consumers.")]
public List<AircraftFuelConsumer> consumers
Field Value
| Type | Description |
|---|---|
| List<AircraftFuelConsumer> |
fuelTankSelector
Tank selection mode: -1 for balanced consumption from all tanks, or 0-n for specific tank index.
Declaration
[Tooltip("Set to -1 for all or 0 to n for fuel tank index.\r\nFuel tanks appear in hierarchy order.")]
public int fuelTankSelector
Field Value
| Type | Description |
|---|---|
| int |
Remarks
Use -1 to draw equally from all tanks (balanced consumption). Use specific index (0, 1, 2...) to draw only from that tank. Allows simulating tank switching procedures and single-tank operation.
fuelTanks
All fuel tanks on this aircraft. Automatically populated on Awake. Order matches hierarchy order for use with fuelTankSelector index.
Declaration
[Tooltip("List of aircraft fuel providers / fuel tanks.")]
public List<AircraftFuelTank> fuelTanks
Field Value
| Type | Description |
|---|---|
| List<AircraftFuelTank> |
totalAvailableFuel
Current sum of fuel in all selected tanks (in liters). Updated each FixedUpdate. Unselected tanks are excluded from this value.
Declaration
[Tooltip(" Total currently available fuel in the selected fuel tanks.\r\n Fuel tanks that are not selected will be ignored.")]
public float totalAvailableFuel
Field Value
| Type | Description |
|---|---|
| float |
Properties
| Edit this page View SourceHasFuel
Returns true if any selected fuel tanks contain fuel.
Declaration
public bool HasFuel { get; }
Property Value
| Type | Description |
|---|---|
| bool |