Configured engine to use altimeter
This commit is contained in:
@@ -2,15 +2,15 @@ using UnityEngine;
|
||||
|
||||
public class MainEngine : MonoBehaviour
|
||||
{
|
||||
[Header("Fuel Source")]
|
||||
[Header("References")]
|
||||
public FuelTank fuelTank; // Reference to the fuel tank supplying this engine
|
||||
public Altimeter altimeter; // Reference to the altimeter for gravity calculations
|
||||
|
||||
[Header("Engine Settings")]
|
||||
public float maxThrust = 1000f; // kN
|
||||
public float Isp = 300f; // seconds
|
||||
public float throttleRampTime = 2f; // seconds to reach full throttle
|
||||
public float minStartupFlow = 0.05f; // minimum fraction of max flow to maintain ignition
|
||||
public float g = 9.81f; // gravitational acceleration (m/s^2) (to be replaced)
|
||||
public AnimationCurve throttleCurve = AnimationCurve.Linear(0, 0, 1, 1);
|
||||
|
||||
[Header("Efficiency Settings")]
|
||||
@@ -29,6 +29,7 @@ public class MainEngine : MonoBehaviour
|
||||
private bool everStarted = false; // tracks if engine has ever been started
|
||||
private float postIgnitionTimer = 0f; // timer for post-ignition grace period
|
||||
private const float postIgnitionGrace = 0.5f; // seconds to allow ramp-up after ignition
|
||||
private float g = 9.81f; // local gravity from altimeter
|
||||
|
||||
void Update()
|
||||
{
|
||||
@@ -55,6 +56,8 @@ public class MainEngine : MonoBehaviour
|
||||
/// </summary>
|
||||
private void HandleEngineState()
|
||||
{
|
||||
g = (float)altimeter.gh; // Update local gravity from altimeter each frame
|
||||
|
||||
// Check if engine is offline and restartable conditions
|
||||
|
||||
if (!engineOnline)
|
||||
|
||||
Reference in New Issue
Block a user