示例#1
0
        /// <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;
        }
示例#2
0
        public void Update(GameTime gameTime, bool newValue)
        {
            InternalAnimator.Update(gameTime, newValue);
            CurrentValue = MathHelper.Clamp(InternalAnimator.CurrentValue, AnimationDesc.MinValue, AnimationDesc.MaxValue);

            if (MathHelper.Distance(CurrentValue, PreviousNotifiedValue) > AnimationDesc.NotifyThreshold)
            {
                RaisePropertyChangedForGroup(XamlAnimationGroupName, AnimationDesc.SecondaryGroupName);
                PreviousNotifiedValue = CurrentValue;
            }
        }
示例#3
0
        public void Update(GameTime gameTime)
        {
            GameOverModalMarginAnimation.Update(gameTime, GameController.IsGameOver);
            if (MathHelper.Distance(GameOverModalMargin.Left, PreviousNotifiedGameOverMargin) > 0.01)
            {
                RaisePropertyChangedForGroup(GameOverVisibilityGroup);
                PreviousNotifiedGameOverMargin = GameOverModalMargin.Left;
            }


            GameOverModalOpacityAnimation.Update(gameTime, GameController.IsGameOver);
            if (MathHelper.Distance(GameOverModalOpacity, PreviousNotifiedGameOverOpacity) > 0.01)
            {
                RaisePropertyChangedForGroup(GameOverVisibilityGroup);
                PreviousNotifiedGameOverOpacity = GameOverModalOpacity;
                Log.Info("Opacity: " + GameOverModalOpacityAnimation.CurrentValue);
            }
        }