Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        private void Update()
        {
            if (Mode == AtmosMode.GameLoop && Running)
            {
                try
                {
                    AtmosThread.RunStep();
                }
                catch (Exception e)
                {
                    Logger.LogError($"Exception in Atmos Thread! Will no longer mix gases!\n{e.StackTrace}",
                                    Category.Atmos);
                    throw;
                }
            }

            if (roundStartedServer)
            {
                if (tickRate == 0)
                {
                    tickRate = tickRateComplete / Steps;
                }

                tickCount += Time.deltaTime;

                if (tickCount > tickRate)
                {
                    DoTick();
                    tickCount   = 0f;
                    currentTick = ++currentTick % Steps;
                }
            }
        }
Exemplo n.º 3
0
 public override void Awake()
 {
     base.Awake();
     processPipeDelegator  = ProcessPipe;
     atmosThread           = gameObject.AddComponent <AtmosThread>();
     atmosThread.tickDelay = 40;
     simulation            = new AtmosSimulation();
     sampler = CustomSampler.Create("AtmosphericsStep");
 }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
 void OnRoundEnd()
 {
     roundStartedServer = false;
     AtmosThread.ClearAllNodes();
     inGameNewPipes.Clear();
 }