Exemplo n.º 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);
            }
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 4
0
 public bool HandleInput(FrameContext frameContext)
 {
     return InputHandler.Handle(frameContext);
 }
Exemplo n.º 5
0
 private void HandleSystemCommands(FrameContext frameContext)
 {
     if (frameContext.LastPlayerAction == Enums.Intent.RegenerateMap)
     {
         World.Map = MapLoader.LoadMap(TileFactory);
     }
 }