コード例 #1
0
        /// <summary>
        /// Takes gases from a GasMix and puts them into blood as a reagent
        /// </summary>
        public void GasExchangeToBlood(GasMix atmos, ReagentMix blood, ReagentMix toProcess, float LungCapacity)
        {
            lock (toProcess.reagents)
            {
                foreach (var Reagent in toProcess.reagents.m_dict)
                {
                    blood.Add(Reagent.Key, Reagent.Value);
                }
            }


            if (!canBreathAnywhere)
            {
                if (LungCapacity + 0.1f > atmos.Moles)                 //Just so scenario where there isn't Gas * 0 = 0
                {
                    atmos.MultiplyGas(0.01f);
                }
                else
                {
                    if (atmos.Moles == 0)
                    {
                        return;
                    }

                    var percentageRemaining = 1 - (LungCapacity / atmos.Moles);
                    atmos.MultiplyGas(percentageRemaining);
                }
            }
        }