//----------------------------------------------------------------------------------- public void UpdateTimeSlider() { double simulatingCurrentTime = EditorApplication.timeSinceStartup; double elapsedTime = simulatingCurrentTime - lastSimulatingTime_; lastSimulatingTime_ = simulatingCurrentTime; frameSpentTime_ += elapsedTime; currentIteration_ = (int)(frameSpentTime_ / iterationTimeEstimation_); if (CarPlayerWindow.IsOpen && SimulationManager.IsTimeSliderUpdateRequired()) { SimulationManager.UpdateTimeSliderState(timeSliderState_); EstimateFrameTimeAndIterations(); frame_ = timeSliderState_.frame_; fillFrame_ = timeSliderState_.fillFrame_; maxFrames_ = timeSliderState_.maxFrames_; colorBackground_ = timeSliderState_.colorBackground_; MaxFramesString = maxFrames_.ToString(); TimeSpan maxTimeSpan = TimeSpan.FromSeconds(MaxTime); MaxTimeString = string.Format("{0:D2}h : {1:D2}m : {2:D2}s : {3:D3}ms", maxTimeSpan.Hours, maxTimeSpan.Minutes, maxTimeSpan.Seconds, maxTimeSpan.Milliseconds); } TimeSpan timeSpan = TimeSpan.FromSeconds(Time); TimeString = string.Format("{0:D2}h : {1:D2}m : {2:D2}s : {3:D3}ms", timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds); CarPlayerWindow.RepaintIfOpen(); }
//---------------------------------------------------------------------------------- private void DrawBakeBar() { GUIStyle style = new GUIStyle(EditorStyles.miniButton); style.alignment = TextAnchor.MiddleLeft; EditorGUI.BeginDisabledGroup(player_.IsSimulating); if (GUILayout.Button(new GUIContent(" Bake simulation", rec_), style, GUILayout.Width(135f), GUILayout.Height(25f))) { if (!CarBakeSimulationMenu.IsOpen) { CarBakeSimulationMenu bakeSimMenu = ScriptableObject.CreateInstance <CarBakeSimulationMenu>(); bakeSimMenu.titleContent = new GUIContent("CaronteFX - Bake Simulation Menu"); } CarBakeSimulationMenu.Instance.ShowUtility(); CarBakeFrameMenu.CloseIfOpen(); } if (GUILayout.Button(new GUIContent("Bake current frame", rec_), style, GUILayout.Width(135f), GUILayout.Height(25f))) { if (!CarBakeFrameMenu.IsOpen) { CarBakeFrameMenu bakeFrameMenu = ScriptableObject.CreateInstance <CarBakeFrameMenu>(); bakeFrameMenu.titleContent = new GUIContent("CaronteFX - Bake Current Frame Menu"); } CarBakeFrameMenu.Instance.ShowUtility(); CarBakeSimulationMenu.CloseIfOpen(); } EditorGUI.EndDisabledGroup(); GUILayout.Space(10f); if (GUILayout.Button("Change to edit mode", EditorStyles.miniButton, GUILayout.Width(125f), GUILayout.Height(25f))) { CarPlayerWindow.CloseIfOpen(); } GUILayout.Space(10f); DrawProgressBox(); GUILayout.Space(6f); }
//----------------------------------------------------------------------------------- private void ChangeToEditMode() { CarPlayerWindow.InstanceWillClose(); PrepareToRestartSimulation(); }