Beispiel #1
0
 public GasCell(Tile _attachedTile)
 {
     gasVel         = new Vector2(0, 0);
     NextGasVel     = new Vector2(0, 0);
     lastSentGasses = new Dictionary <GasType, float>();
     gasMixture     = new GasMixture();
     rand           = new Random();
     attachedTile   = _attachedTile;
 }
Beispiel #2
0
 public GasCell(Tile _attachedTile)
 {
     gasVel = new Vector2(0, 0);
     NextGasVel = new Vector2(0, 0);
     lastSentGasses = new Dictionary<GasType, float>();
     gasMixture = new GasMixture();
     rand = new Random();
     attachedTile = _attachedTile;
 }
Beispiel #3
0
        public void Diffuse(GasMixture a, float factor = 8)
        {
            for (var i = 0; i < a.gasses.Length; i++)
            {
                float amount = (a.gasses[i] - gasses[i]) / factor;
                AddNextGas(amount, (GasType)i);
                a.AddNextGas(-amount, (GasType)i);
            }

            ShareTemp(a, factor);
        }
Beispiel #4
0
        public void ShareTemp(GasMixture a, float factor = 8)
        {
            float HCCell     = HeatCapacity * TotalMass;
            float HCa        = a.HeatCapacity * a.TotalMass;
            float energyFlow = a.Temperature - Temperature;

            if (energyFlow > 0.0f)
            {
                energyFlow *= HCa;
            }
            else
            {
                energyFlow *= HCCell;
            }

            energyFlow *= (1 / factor);
            SetNextTemperature((energyFlow / HCCell));
            a.SetNextTemperature(-(energyFlow / HCa));
        }
Beispiel #5
0
        public void ShareTemp(GasMixture a, float factor = 8)
        {
            float HCCell = HeatCapacity*TotalMass;
            float HCa = a.HeatCapacity*a.TotalMass;
            float energyFlow = a.Temperature - Temperature;

            if (energyFlow > 0.0f)
            {
                energyFlow *= HCa;
            }
            else
            {
                energyFlow *= HCCell;
            }

            energyFlow *= (1/factor);
            SetNextTemperature((energyFlow/HCCell));
            a.SetNextTemperature(-(energyFlow/HCa));
        }
Beispiel #6
0
        public void Diffuse(GasMixture a, float factor = 8)
        {
            for (var i = 0; i < a.gasses.Length; i++)
            {
                float amount = (a.gasses[i] - gasses[i])/factor;
                AddNextGas(amount, (GasType)i);
                a.AddNextGas(-amount, (GasType)i);
            }

            ShareTemp(a, factor);
        }