public void Update(FrameContext frameContext) { HandleSystemCommands(frameContext); foreach (var actor in ActorControllers) { actor.Update(frameContext); } foreach (var furniture in FurnitureControllers) { furniture.Update(frameContext); } }
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(); } }
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; } }
public bool HandleInput(FrameContext frameContext) { return InputHandler.Handle(frameContext); }
private void HandleSystemCommands(FrameContext frameContext) { if (frameContext.LastPlayerAction == Enums.Intent.RegenerateMap) { World.Map = MapLoader.LoadMap(TileFactory); } }