private void DoStuffWith(VesselModule data)
{
// Get the information about it.
string burnType = data.Fields[BURN_TYPE_FIELD].GetValue(data).ToString();
double burnTime = data.Fields[BURN_TIME_FIELD].GetValue<double>(data);
double dV = data.Fields[DV_FIELD].GetValue<double>(data);
double timeUntil = data.Fields[TIME_UNTIL_FIELD].GetValue<double>(data);
bool isInsufficientFuel = data.Fields[INSUFFICIENT_FUEL_FIELD].GetValue<bool>(data);
// Check to make sure we actually have data.
if (NO_DATA == burnType)
{
Debug.Log("[Example] No burn info is available.");
return;
}
// Okay, we have data, do with it as we will.
string message = string.Format(
"[Example] {0} of {1:0.0} m/s {2}: {3}",
burnType,
dV,
(double.IsNaN(timeUntil)) ? "(overdue)" : string.Format("in {0:0.0} seconds", timeUntil),
double.IsInfinity(burnTime) ? "N/A" : string.Format("{0:0.0} seconds to burn", burnTime));
if (isInsufficientFuel)
{
message += " (Warning! Not enough fuel)!";
}
Debug.Log(message);
}