I don't remember what I did but it was probably important
This commit is contained in:
@@ -3,19 +3,32 @@ using UnityEngine;
|
||||
public class FuelTank : MonoBehaviour
|
||||
{
|
||||
public float fuelAmount = 1000f; // kg of fuel available in the tank
|
||||
public float rcsFuelAmount = 200f; // kg of monopropellant available for RCS
|
||||
public bool isEmpty => fuelAmount <= 0f;
|
||||
public bool isRcsEmpty => rcsFuelAmount <= 0f;
|
||||
public float RequestFuel(float amount)
|
||||
{
|
||||
float fuelGiven = Mathf.Min(amount, fuelAmount);
|
||||
fuelAmount -= fuelGiven;
|
||||
return fuelGiven;
|
||||
}
|
||||
public float RequestRcsFuel(float amount)
|
||||
{
|
||||
float fuelGiven = Mathf.Min(amount, rcsFuelAmount);
|
||||
rcsFuelAmount -= fuelGiven;
|
||||
return fuelGiven;
|
||||
}
|
||||
public float GetFuelAmount() => fuelAmount;
|
||||
public float GetRcsFuelAmount() => rcsFuelAmount;
|
||||
void Update()
|
||||
{
|
||||
if (fuelAmount <= 0f)
|
||||
{
|
||||
fuelAmount = 0f;
|
||||
}
|
||||
if (rcsFuelAmount <= 0f)
|
||||
{
|
||||
rcsFuelAmount = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user