public void Divide(float DivideAmount, bool ChangeVolume = true) { if (DivideAmount == 0) { Logger.LogError(" divide by 0 in Divide"); } float GasVolume = gasMix.Volume; if (ChangeVolume) { GasVolume = GasVolume / DivideAmount; } Mix.Divide(DivideAmount); var Newone = new float[gasMix.Gases.Length]; for (int i = 0; i < gasMix.Gases.Length; i++) { Newone[i] = gasMix.Gases[i] / DivideAmount; } gasMix = GasMix.FromTemperature(Newone, gasMix.Temperature, GasVolume); }
public Tuple <ReagentMix, GasMix> Take(MixAndVolume InmixAndVolume, bool removeVolume = true) { if (Volume == 0) { Logger.LogError(" divide by 0 in Take "); } float Percentage = InmixAndVolume.Volume / Volume; float RemoveGasVolume = gasMix.Volume; float GasVolume = gasMix.Volume; if (removeVolume) { RemoveGasVolume = RemoveGasVolume * Percentage; GasVolume = GasVolume * (1 - Percentage); } var ReturnMix = Mix.Take(Mix.Total * Percentage); var Newone = new float[gasMix.Gases.Length]; var RemoveNewone = new float[gasMix.Gases.Length]; for (int i = 0; i < gasMix.Gases.Length; i++) { RemoveNewone[i] = gasMix.Gases[i] * Percentage; Newone[i] = gasMix.Gases[i] * (1 - Percentage); } gasMix = GasMix.FromTemperature(Newone, gasMix.Temperature, GasVolume); return(new Tuple <ReagentMix, GasMix>(ReturnMix, GasMix.FromTemperature(RemoveNewone, gasMix.Temperature, RemoveGasVolume))); }
static GasMixes() { float[] gases = new float[Gas.Count]; gases[Gas.Oxygen] = 16.628484400890768491815384755837f / 2 * 2.5f; gases[Gas.Nitrogen] = 66.513937603563073967261539023347f / 2 * 2.5f; Air = GasMix.FromTemperature(gases, Reactions.T0C + 20); }
static GasMixes() { float[] gases = new float[Gas.Count]; gases[Gas.Oxygen] = 0.001f; gases[Gas.CarbonDioxide] = 0.01f; gases[Gas.Nitrogen] = 0; Space = GasMix.FromTemperature(gases, 2.7f); gases[Gas.CarbonDioxide] = 0; gases[Gas.Oxygen] = 16.628484400890768491815384755837f / 2 * 2.5f; gases[Gas.Nitrogen] = 66.513937603563073967261539023347f / 2 * 2.5f; Air = GasMix.FromTemperature(gases, Reactions.KOffsetC + 20); gases[Gas.Oxygen] = 0; gases[Gas.Nitrogen] = 0; Empty = GasMix.FromTemperature(gases, Reactions.KOffsetC + 20); }
public void Multiply(float MultiplyAmount, bool ChangeVolume = true) { float GasVolume = gasMix.Volume; if (ChangeVolume) { GasVolume = GasVolume * MultiplyAmount; } Mix.Multiply(MultiplyAmount); var Newone = new float[gasMix.Gases.Length]; for (int i = 0; i < gasMix.Gases.Length; i++) { Newone[i] = gasMix.Gases[i] * MultiplyAmount; } gasMix = GasMix.FromTemperature(Newone, gasMix.Temperature, GasVolume); }
public void Add(MixAndVolume mixAndVolume, bool ChangeVolume = true) { float internalEnergy = mixAndVolume.InternalEnergy + this.InternalEnergy; float GasVolume = gasMix.Volume; if (ChangeVolume) { GasVolume = GasVolume + mixAndVolume.gasMix.Volume; } Mix.Add(mixAndVolume.Mix); var Newone = new float[gasMix.Gases.Length]; for (int i = 0; i < gasMix.Gases.Length; i++) { Newone[i] = gasMix.Gases[i] + mixAndVolume.gasMix.Gases[i]; } gasMix = GasMix.FromTemperature(Newone, gasMix.Temperature, GasVolume); this.InternalEnergy = internalEnergy; }
public override void OnStartServer() { GasMix = GasMix.FromTemperature(Gases, Temperature, Volume); }
private void Validate() { gasMix = GasMix.FromTemperature(gasMix.GasData, Reactions.KOffsetC + 20, volumeOverride); }
public void UpdateGasMix() { gasIsInitialised = true; GasMix = GasMix.FromTemperature(Gases, Temperature, Volume); }
public void UpdateGasMix() { gasIsInitialised = true; GasMix = GasMix.FromTemperature(StoredGasMix.GasData, Temperature, Volume); }
private void Validate() { Undo.RecordObject(gameObject, "Gas Change"); StoredGasMix = GasMix.FromTemperature(StoredGasMix.GasData, Temperature, Volume); }
private void UpdateGasMix() { container.GasMix = GasMix.FromTemperature(container.Gases, container.Temperature, container.Volume); }
public void UpdateGasMix() { GasMix = GasMix.FromTemperature(Gases, Temperature, Volume); }