Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }