public override void Update(TimeSpan timeElapsed)
        {
            // If there is a console that is focused, this one doesn't need to do anything.
            if (Global.FocusedConsoles.Console != null)
            {
                return;
            }

            // Can through the list of actions and pop out the finished ones
            while (ActionProcessor.Peek().IsFinished)
            {
                ActionProcessor.Pop();
            }

            // Run the latest action.
            ActionProcessor.Peek().Run(timeElapsed);

            // If the action finished, pop it out.
            if (ActionProcessor.Peek().IsFinished)
            {
                ActionProcessor.Pop();
            }

            // Center view on player
            Map.CenterViewPortOnPoint(Map.ControlledGameObject.Position);

            // Run logic if valid move made by player
            if (RunLogicFrame)
            {
                RunGameLogicFrame();
            }

            if (RedrawMap)
            {
                Map.IsDirty = true;
                RedrawMap   = false;
            }
            //point.X = Math.Max(0, point.X);
            //point.Y = Math.Max(0, point.Y);
            //point.X = Math.Min(point.X, map.Width - DungeonScreen.Width);
            //point.Y = Math.Min(point.Y, map.Height - DungeonScreen.Height);

            //MapViewPoint = point;

            base.Update(timeElapsed);
        }
示例#2
0
        public override void Update(TimeSpan timeElapsed)
        {
            if (SadConsole.Global.FocusedConsoles.Console != null)
            {
                return;
            }

            while (ActionProcessor.Peek().IsFinished)
            {
                ActionProcessor.Pop();
            }

            ActionProcessor.Peek().Run(timeElapsed);

            if (ActionProcessor.Peek().IsFinished)
            {
                ActionProcessor.Pop();
            }

            // Center view on player
            Map.Surface.CenterViewPortOnPoint(Map.ControlledGameObject.Position);

            // Run logic if valid move made by player
            if (RunLogicFrame)
            {
                RunGameLogicFrame();
            }

            if (RedrawMap)
            {
                Map.Surface.IsDirty = true;
                RedrawMap           = false;
            }
            //point.X = Math.Max(0, point.X);
            //point.Y = Math.Max(0, point.Y);
            //point.X = Math.Min(point.X, map.Width - DungeonScreen.Width);
            //point.Y = Math.Min(point.Y, map.Height - DungeonScreen.Height);

            //MapViewPoint = point;

            base.Update(timeElapsed);
        }