private static void AddButtonGroup(AtmosManager atmosManager) { EditorGUILayout.BeginHorizontal(); GUI.enabled = Application.isPlaying && atmosManager.Mode != AtmosMode.Manual; if (GUILayout.Button("SetSpeed")) { AtmosManager.SetInternalSpeed(); } if (!atmosManager.Running) { if (GUILayout.Button("Start")) { atmosManager.StartSimulation(); } } else if (GUILayout.Button("Stop")) { atmosManager.StopSimulation(); } GUI.enabled = Application.isPlaying && !atmosManager.Running; if (GUILayout.Button("Step")) { AtmosThread.RunStep(); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(this); } }
private void Awake() { processPipeDelegator = ProcessPipe; if (Instance == null) { Instance = this; } else { Destroy(this); } }
/// <summary> /// Transfers heat between an Open tile and a Solid tile /// Uses data from MetaDataNode for SolidNode and GasMix values for Open node /// </summary> private void ConductFromOpenToSolid(MetaDataNode solidNode, GasMix meanGasMix) { var tempDelta = solidNode.ConductivityTemperature - meanGasMix.Temperature; if (Mathf.Abs(tempDelta) <= AtmosDefines.MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) { return; } if (meanGasMix.WholeHeatCapacity <= AtmosConstants.MINIMUM_HEAT_CAPACITY) { return; } if (solidNode.HeatCapacity <= AtmosConstants.MINIMUM_HEAT_CAPACITY) { return; } //The larger the combined capacity the less is shared var heat = solidNode.ThermalConductivity * tempDelta * (solidNode.HeatCapacity * meanGasMix.WholeHeatCapacity / (solidNode.HeatCapacity + meanGasMix.WholeHeatCapacity)); solidNode.ConductivityTemperature = Mathf.Max( solidNode.ConductivityTemperature - (heat / solidNode.HeatCapacity), AtmosDefines.SPACE_TEMPERATURE); meanGasMix.SetTemperature(Mathf.Max( meanGasMix.Temperature + (heat / meanGasMix.WholeHeatCapacity), AtmosDefines.SPACE_TEMPERATURE)); //Do atmos update for the Solid node if temperature is allowed so it can do conduction //This is checking for the start temperature as this is how the cycle will begin if (solidNode.ConductivityTemperature < AtmosDefines.MINIMUM_TEMPERATURE_START_SUPERCONDUCTION) { return; } if (solidNode.AllowedToSuperConduct == false) { solidNode.AllowedToSuperConduct = true; //Allow this node to trigger other tiles super conduction solidNode.StartingSuperConduct = true; } AtmosManager.Update(solidNode); }
/// <summary> /// Used to transfer heat between an Solid tile and Solid tile /// Uses data from MetaDataNode for the current solid node and MetaDataNode date for the other Solid node /// </summary> private void ConductFromSolidToSolid(MetaDataNode currentNode, MetaDataNode solidNode, float tempDelta) { if (Mathf.Abs(tempDelta) <= AtmosDefines.MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) { return; } //The larger the combined capacity the less is shared var heat = solidNode.ThermalConductivity * tempDelta * (currentNode.HeatCapacity * solidNode.HeatCapacity / (currentNode.HeatCapacity + solidNode.HeatCapacity)); //The higher your own heat cap the less heat you get from this arrangement currentNode.ConductivityTemperature -= heat / currentNode.HeatCapacity; solidNode.ConductivityTemperature += heat / solidNode.HeatCapacity; //Do atmos update for the next solid node if temperature is allowed so it can do conduction if (solidNode.ConductivityTemperature < AtmosDefines.MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION) { return; } solidNode.AllowedToSuperConduct = true; AtmosManager.Update(solidNode); }
public override void OnInspectorGUI() { AtmosManager atmosManager = (AtmosManager)target; GUIContent speedContent = new GUIContent("Speed", "frequency of Atmos simulation updates (Millieseconds between each update)"); GUIContent SubOperations = new GUIContent("SubOperations", "The number of operations done in each update ( meant for sub millisecond adjustment )"); GUIContent numThreadsContent = new GUIContent("Threads", "not currently implemented, thread count is always locked at one regardless of this setting"); atmosManager.Mode = (AtmosMode)EditorGUILayout.EnumPopup("Mode", atmosManager.Mode); atmosManager.Speed = EditorGUILayout.Slider(speedContent, atmosManager.Speed, 0, 5000); GUI.enabled = atmosManager.Mode == AtmosMode.Threaded; atmosManager.NumberThreads = EditorGUILayout.IntSlider(numThreadsContent, atmosManager.NumberThreads, 1, 1); GUI.enabled = true; AddButtonGroup(atmosManager); EditorGUILayout.LabelField("Update List Count", AtmosThread.GetUpdateListCount().ToString()); DrawDefaultInspector(); }