/// <summary> /// Updates the state of the map renerer to prepare for drawing. /// </summary> public void Update(GameTime time) { BackgroundTiles.Update(time); SpriteMoveAnimation Animation = Player.GetAnimation(AnimationType.MoveToNewRoom) as SpriteMoveAnimation; // Currently, setting the target position on this animation saves its current position as the new starting // point. This means that as it gets closer to the target, the overall distance that the animation needs to // travel decreases. This creates the "easing" that we see, but it isn't being done in an obvious way. // TODO: Fix this and remove the above comment essay Animation.TargetPosition = GetPlayerTargetPosition(); Player.Update(time); UpdateCamera(); UpdateWumpus(); if (ParticleSystemsEnabled && BackFogSystem != null && FrontFogSystem != null) { BackFogSystem.Update(time); FrontFogSystem.Update(time); } UpdateRoomAnimators(GoldFadeAnimators, r => r.Gold > 0, time); UpdateRoomAnimators(BatFadeAnimators, r => r.HasBats, time); CamZoomAnimator.Update(time, Map.Cave[Map.PlayerRoom].HasPit); MapCam.Zoom = OverriddenCameraZoom ?? CamZoomAnimator.CurrentValue; }
public void Update(GameTime time) { // Only update periodically (not every frame) if (time.TotalGameTime.TotalSeconds - LastMoveTime > SecondsPerMove) { // Update the last updated time LastMoveTime = time.TotalGameTime.TotalSeconds; // Add the new position PickNextPosition(); // Set the new animation targets (Wumpus.GetAnimation(AnimationType.MoveToNewMenuTile) as SpriteMoveAnimation).TargetPosition = Path.LatestValue; (PlayerCharacter.GetAnimation(AnimationType.MoveToNewMenuTile) as SpriteMoveAnimation).TargetPosition = Path.EarliestValue; } // Update the animations every frame Wumpus.Update(time); PlayerCharacter.Update(time); }