private void Move(int rows, int cols) { if (_fovMap.IsWalkable(_position.X + cols, _position.Y + rows)) { _position.X += cols; _position.Y += rows; _statistics.AddToStatistic(Statistic.StepsTaken, 1); } var cell = _map[_position.Y, _position.X]; if (cell.Is(RCell.Door) && cell.Is(RCell.Closed)) { cell &= ~RCell.Closed; cell |= RCell.Open; _map[_position.Y, _position.X] = cell; _map.SetVisible(_position.X, _position.Y, true); _statistics.AddToStatistic(Statistic.DoorsOpened, 1); } RecaclulateFoV(); }
public void DrawMap(IRMap map, IOverworldCamera camera, IOverworldPlayer player, IMobPackManager mobPackManager, IStatistics statistics, IRConsole target = null) { var targetConsole = target ?? RootConsole; Clear(); var viewPort = camera.ViewPort; for (var row = 0; row <= viewPort.Height; ++row) { for (var col = 0; col <= viewPort.Width; ++col) { var charCell = ' '; var cellColour = TCODColor.white; var mapRow = viewPort.Y + row; var mapCol = viewPort.X + col; var cell = map[mapRow, mapCol]; cellColour = GetRarityColour(cell, cellColour); if (cell.Is(RCell.Wall)) { charCell = '#'; } if (cell.Is(RCell.Floor)) { charCell = '.'; } if (cell.Is(RCell.Door)) { charCell = 'D'; } if (cell.Is(RCell.Small)) { charCell = 'S'; } if (cell.Is(RCell.Normal)) { charCell = 'N'; } if (cell.Is(RCell.Big)) { charCell = 'B'; } if (cell.Is(RCell.Grand)) { charCell = 'G'; } if (cell.Is(RCell.Portal)) { charCell = 'O'; } foreach (var pack in from pack in mobPackManager.MobPacks let packX = pack.Position.X let packY = pack.Position.Y where mapCol == packX && mapRow == packY && player.CanSee(packX, packY) select pack) { charCell = 'E'; cellColour = pack.Strength.GetAssociatedColour(); } if (mapCol == player.Position.X && mapRow == player.Position.Y) { charCell = '@'; cellColour = TCODColor.white; } var visitedMod = .2f; if (player.CanSee(mapCol, mapRow)) { if (!cell.Is(RCell.Visited)) { statistics.AddToStatistic(Statistic.SquaresRevealed, 1); } visitedMod = 1f; map[mapRow, mapCol] |= RCell.Visited; } if (cell.Is(RCell.Dark)) { visitedMod *= 0.5f; } if (!cell.Is(RCell.Visited)) { continue; } cellColour = cellColour.Multiply(visitedMod); SetCharacter(col, row, charCell, cellColour); } } targetConsole.Blit(this, Bounds, _posX, _posY); }