Exemple #1
0
        private void Run()
        {
            FrameLimiter frameLimiter = new FrameLimiter(
                ActiveConfig.TickRate > 0 ?
                TimeSpan.FromMilliseconds(1000 / (double)ActiveConfig.TickRate) :
                TimeSpan.Zero);
            bool bRunning = true;

            while (bRunning)
            {
                Update(frameLimiter.LastFrameTime);
                frameLimiter.Throttle();
                lock (m_StopRequestLock)
                {
                    bRunning = !m_IsStopRequest;
                }
            }
        }
Exemple #2
0
            private void run()
            {
                FrameLimiter frameLimiter = new FrameLimiter(targetTickTime);
                bool         bRunning     = true;

                while (bRunning)
                {
                    if (bRunning)
                    {
                        action();
                    }

                    frameLimiter.Throttle();
                    lock (m_StopRequestLock)
                    {
                        bRunning = !m_bStopRequest;
                    }
                }
            }
 void Update()
 {
     limit = Mathf.Clamp(limit, 2, 500);
     FrameLimiter.SetLimitFPS(limit);
     FrameLimiter.Enabled = enable;
 }
 void Start()
 {
     soundSource = GetComponent<AudioSource>();
     AudioClip clip = (AudioClip)Resources.Load(pathToWarningSounds+DataKeeper.dk.currentSignal);
     soundSource.clip = clip;
     soundSource.volume = 1;
     carRigidbody = car.GetComponent<Rigidbody>();
     carControllerScript = car.GetComponent<CarController>();
     frameLimiterScript = GetComponent<FrameLimiter>();
     Time.timeScale = 1;
 }