Example #1
0
        //-----------------------------------------------------------------------------------
        public void UpdateTimeSlider()
        {
            double simulatingCurrentTime = EditorApplication.timeSinceStartup;

            double elapsedTime = simulatingCurrentTime - lastSimulatingTime_;

            lastSimulatingTime_ = simulatingCurrentTime;

            frameSpentTime_ += elapsedTime;

            currentIteration_ = (int)(frameSpentTime_ / iterationTimeEstimation_);

            if (CRPlayerWindow.IsOpen && SimulationManager.IsTimeSliderUpdateRequired())
            {
                SimulationManager.UpdateTimeSliderState(timeSliderState_);
                EstimateFrameTimeAndIterations();

                frame_           = timeSliderState_.frame_;
                fillFrame_       = timeSliderState_.fillFrame_;
                maxFrames_       = timeSliderState_.maxFrames_;
                colorBackground_ = timeSliderState_.colorBackground_;

                MaxFramesString = maxFrames_.ToString();
                MaxTimeString   = (maxFrames_ * (float)frameTime_).ToString("F2");
            }
            CRPlayerWindow.RepaintIfOpen();
        }
Example #2
0
        //-----------------------------------------------------------------------------------
        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();
        }