Exemple #1
0
        // ReSharper disable once UnusedMember.Local
        private void Update()
        {
            var now = Stopwatch.GetTimestamp();

            if (_nextTick > now)
            {
                return;
            }

            _nextTick += Stopwatch.Frequency / UpdateRate;

            UnityEngine.Profiling.Profiler.BeginSample(String.Format("{0}.Update", GetType().Name), this);

            if (Net != null && !DisableCheckForMessages)
            {
                using (_checkForMessages.Sample()) {
                    Net.CheckForMessages();
                }
            }

            using (_onUpdate.Sample()) {
                OnUpdate();
            }

            if (Net != null && !DisableFlushSentMessages)
            {
                using (_flushSentMessages.Sample()) {
                    Net.FlushSentMessages();
                }
            }

            UnityEngine.Profiling.Profiler.EndSample();
        }