示例#1
0
        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);
        }
示例#2
0
        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)));
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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;
        }
示例#7
0
 public override void OnStartServer()
 {
     GasMix = GasMix.FromTemperature(Gases, Temperature, Volume);
 }
示例#8
0
 private void Validate()
 {
     gasMix = GasMix.FromTemperature(gasMix.GasData, Reactions.KOffsetC + 20, volumeOverride);
 }
示例#9
0
 public void UpdateGasMix()
 {
     gasIsInitialised = true;
     GasMix           = GasMix.FromTemperature(Gases, Temperature, Volume);
 }
示例#10
0
 public void UpdateGasMix()
 {
     gasIsInitialised = true;
     GasMix           = GasMix.FromTemperature(StoredGasMix.GasData, Temperature, Volume);
 }
示例#11
0
 private void Validate()
 {
     Undo.RecordObject(gameObject, "Gas Change");
     StoredGasMix = GasMix.FromTemperature(StoredGasMix.GasData, Temperature, Volume);
 }
示例#12
0
 private void UpdateGasMix()
 {
     container.GasMix = GasMix.FromTemperature(container.Gases, container.Temperature, container.Volume);
 }
示例#13
0
 public void UpdateGasMix()
 {
     GasMix = GasMix.FromTemperature(Gases, Temperature, Volume);
 }