Пример #1
0
 public GameClock()
 {
     GameTime = new GameTime(TimeSpan.Zero, TimeSpan.Zero);
 }
Пример #2
0
        /// <summary>
        /// Updates GameTime.
        /// </summary>
        public void Tick()
        {
            // Simulates fluctuations in minute timing.
            double variance = (r.Next((int)(100d * TimeMultiplier)) / 100d) - (r.Next((int)(100d * TimeMultiplier)) / 100d);

            int timeDelta = (int)Math.Round(baseTimePerInterval * Math.Abs((TimeMultiplier + variance)));

            // at least 1 ms passed.
            if (timeDelta == 0)
                timeDelta = 1;

            totalIntervals += timeDelta;

            totalTime = new TimeSpan(0, 0, 0, 0, totalIntervals);
            elapsedTime = new TimeSpan(0, 0, 0, 0, timeDelta);

            this.GameTime = new GameTime(elapsedTime, totalTime);
        }
Пример #3
0
        protected void Update(GameTime gameTime)
        {
            _intervalCount++;

            // Update objects.

        }