//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Sets a level. </summary> /// /// <remarks> Should normally be invoked only by a command. Darrellp, 10/8/2011. </remarks> /// /// <param name="levelCommand"> The level command which invoked this. </param> //////////////////////////////////////////////////////////////////////////////////////////////////// internal void SetLevel(NewLevelCommand levelCommand) { CurrentLevel = new Level(levelCommand.Level, Map, this, levelCommand.Excavator); Map.Fov = new FOV(Map, levelCommand.FOVRows, levelCommand.Filter); Map.MoveCreatureTo(Map.Player, LocateStairwell(), true); InvokeEvent(EventType.NewLevel, this); }
public MapHandler(TerminalControl terminalCtl, WindowsFormsHost mapHost, Game game) { _terminal = new Terminal(ColumnCount, RowCount); terminalCtl.Terminal = _terminal; _mapHost = mapHost; _charWidth = terminalCtl.GlyphSheet.Width; _charHeight = terminalCtl.GlyphSheet.Height; _game = game; _game.HeroMoveEvent += HandleCreatureMoveEvent; _game.AttackEvent += GameAttackEvent; NewLevelCommand levelCommand = new NewLevelCommand { Width = ColumnCount, Height = RowCount, FOVRows = 20, Filter = (locHero, locSite) => MapCoordinates.Within(locHero, locSite, 15, 10, 12), Level = 0 }; _game.EnqueueAndProcess(levelCommand); terminalCtl.Size = terminalCtl.GetPreferredSize(new System.Drawing.Size()); _mainWindow = (MainWindow)Application.Current.MainWindow; }