コード例 #1
0
 public void Update()
 {
     if (_characterSprite != null)
     {
         _characterSprite.Update(GetTime());
     }
 }
コード例 #2
0
        /// <summary>
        /// Handles updating this <see cref="Entity"/>.
        /// </summary>
        /// <param name="imap">The map the <see cref="Entity"/> is on.</param>
        /// <param name="deltaTime">The amount of time (in milliseconds) that has elapsed since the last update.</param>
        protected override void HandleUpdate(IMap imap, int deltaTime)
        {
            base.HandleUpdate(imap, deltaTime);

            // Get the delta time
            var currentTime    = GetTime();
            var lastDrawnDelta = Math.Min(currentTime - _lastDrawnTime, GameData.MaxDrawDeltaTime);

            _lastDrawnTime = currentTime;

            // Update the sprite
            _characterSprite.Update(currentTime);

            UpdateAnimation();

            // Update the interpolation
            _interpolator.Update(this, (int)lastDrawnDelta);
        }