I know the code below fails, but can anyone provide a solution to concatonate the eDamage string & execute the randomly selected aircraft.hitNamed(part.NamedDamageTypes. line?
Code:
string[] eDamage =
{
"ElecBatteryFailure",
"ElecGeneratorFailure",
"ElecIlluminationFailure",
"ElecMasterCompassFailure",
"ElecPrimaryFailure",
"ElecPriNavigationFailure",
"ElecSecNavigationFailure",
"ElecSecondaryFailure",
"ElecTransceiverFailure",
"ElecWeaponryFailure"
};
// ---- Electrics failures ----=
string e = "aircraft.hitNamed(part.NamedDamageTypes." + eDamage[random.Next(eDamage.GetLowerBound(0), eDamage.GetUpperBound(0) + 1)] + ");";
//Console.WriteLine(e);
//Process.Start(e);
// string e conatins the c# code, now how to 'execute' the string as a command?
}