コード例 #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;
                }
            }
        }
コード例 #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;
                    }
                }
            }
コード例 #3
0
 void Update()
 {
     limit = Mathf.Clamp(limit, 2, 500);
     FrameLimiter.SetLimitFPS(limit);
     FrameLimiter.Enabled = enable;
 }
コード例 #4
0
ファイル: GUIHandler.cs プロジェクト: Icontech/CarDrivingGame
 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;
 }