private void TestAreaPressure() { envPressure = 0f; cellCount = 0f; if ((UnityEngine.Object)occupyArea != (UnityEngine.Object)null && (UnityEngine.Object)base.gameObject != (UnityEngine.Object)null) { occupyArea.TestArea(Grid.PosToCell(base.gameObject), this, UpdateStateCb); envPressure /= cellCount; } }
private void UpdateState(float dt) { bool value = consumer.IsSatisfied; envTemp = 0f; cellCount = 0; if ((UnityEngine.Object)occupyArea != (UnityEngine.Object)null && (UnityEngine.Object)base.gameObject != (UnityEngine.Object)null) { occupyArea.TestArea(Grid.PosToCell(base.gameObject), this, UpdateStateCb); envTemp /= (float)cellCount; } lastEnvTemp = envTemp; List <GameObject> items = storage.items; for (int i = 0; i < items.Count; i++) { PrimaryElement component = items[i].GetComponent <PrimaryElement>(); if (component.Mass > 0f && (!isLiquidConditioner || !component.Element.IsGas) && (isLiquidConditioner || !component.Element.IsLiquid)) { value = true; lastGasTemp = component.Temperature; float num = component.Temperature + temperatureDelta; if (num < 1f) { num = 1f; lowTempLag = Mathf.Min(lowTempLag + dt / 5f, 1f); } else { lowTempLag = Mathf.Min(lowTempLag - dt / 5f, 0f); } ConduitFlow conduitFlow = (!isLiquidConditioner) ? Game.Instance.gasConduitFlow : Game.Instance.liquidConduitFlow; float num2 = conduitFlow.AddElement(cooledAirOutputCell, component.ElementID, component.Mass, num, component.DiseaseIdx, component.DiseaseCount); component.KeepZeroMassObject = true; float num3 = num2 / component.Mass; int num4 = (int)((float)component.DiseaseCount * num3); component.Mass -= num2; component.ModifyDiseaseCount(-num4, "AirConditioner.UpdateState"); float num5 = num - component.Temperature; float num6 = num5 * component.Element.specificHeatCapacity * num2; float display_dt = (!(lastSampleTime > 0f)) ? 1f : (Time.time - lastSampleTime); lastSampleTime = Time.time; GameComps.StructureTemperatures.ProduceEnergy(structureTemperature, 0f - num6, BUILDING.STATUSITEMS.OPERATINGENERGY.PIPECONTENTS_TRANSFER, display_dt); break; } } if (Time.time - lastSampleTime > 2f) { GameComps.StructureTemperatures.ProduceEnergy(structureTemperature, 0f, BUILDING.STATUSITEMS.OPERATINGENERGY.PIPECONTENTS_TRANSFER, Time.time - lastSampleTime); lastSampleTime = Time.time; } operational.SetActive(value, false); UpdateStatus(); }
public void UpdateValidity() { bool valid = Valid; Valid = occupyArea.TestArea(Grid.PosToCell(this), this, ValidTest); if (Valid) { animController.TintColour = Color.white; } else { animController.TintColour = Color.red; } if (valid != Valid) { Trigger(-1820564715, Valid); } }
public bool IsCellSafe(int cell) { return(occupyArea.TestArea(cell, this, CellSafeTestDelegate)); }