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; }
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; }
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); }
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)); }
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)); }
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); }