Пример #1
0
        public void Update(FrameContext frameContext)
        {
            HandleSystemCommands(frameContext);

            foreach (var actor in ActorControllers)
            {
                actor.Update(frameContext);
            }

            foreach (var furniture in FurnitureControllers)
            {
                furniture.Update(frameContext);
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            var engine = Bootstrapper.Start();

            var frameContext = new FrameContext() { World = engine.World };

            while (engine.WindowUpdate())
            {
                if (engine.HandleInput(frameContext))
                {
                    engine.Update(frameContext);
                }

                engine.Render();
            }
        }
Пример #3
0
        public bool Handle(FrameContext frameContext)
        {
            if (Console.KeyPressed)
            {
                switch (Console.GetKey())
                {
                    case Key.W:
                        frameContext.LastPlayerAction = Intent.MoveUp;
                        break;

                    case Key.S:
                        frameContext.LastPlayerAction = Intent.MoveDown;
                        break;

                    case Key.A:
                        frameContext.LastPlayerAction = Intent.MoveLeft;
                        break;

                    case Key.D:
                        frameContext.LastPlayerAction = Intent.MoveRight;
                        break;

                    case Key.R:
                        frameContext.LastPlayerAction = Intent.RegenerateMap;
                        break;

                    default:
                        frameContext.LastPlayerAction = Intent.Idle;
                        break;
                }
                return true;
            }
            else
            {
                return false;
            }
        }
Пример #4
0
 public bool HandleInput(FrameContext frameContext)
 {
     return InputHandler.Handle(frameContext);
 }
Пример #5
0
 private void HandleSystemCommands(FrameContext frameContext)
 {
     if (frameContext.LastPlayerAction == Enums.Intent.RegenerateMap)
     {
         World.Map = MapLoader.LoadMap(TileFactory);
     }
 }