示例#1
0
        public ConsoleColor GetCellColor(GridPoint point)
        {
            if (!Maze.MazeCells.ContainsKey(point))
            {
                return(Console.ForegroundColor);
            }

            var cell = Maze.MazeCells[point];

            if (MazeCellType.Wall.Equals(cell.Type))
            {
                return(ConsoleColor.DarkGray);
            }
            if (Maze.CellsWithDoors.ContainsKey(point) &&
                !KeysCollected.ContainsKey(Maze.CellsWithDoors[point].ToLower()))
            {
                return(ConsoleColor.Red);
            }
            if (Maze.CellsWithKeys.ContainsKey(point) &&
                !KeysCollected.ContainsKey(Maze.CellsWithKeys[point]))
            {
                return(ConsoleColor.Cyan);
            }
            if (CurrentPositions.Contains(point))
            {
                return(ConsoleColor.Green);
            }
            return(Console.ForegroundColor);
        }
示例#2
0
        public string GetCellString(GridPoint point)
        {
            if (!Maze.MazeCells.ContainsKey(point))
            {
                return(" ");
            }

            var cell = Maze.MazeCells[point];

            if (MazeCellType.Wall.Equals(cell.Type))
            {
                return("#");
            }
            if (Maze.CellsWithDoors.ContainsKey(point) &&
                !KeysCollected.ContainsKey(Maze.CellsWithDoors[point].ToLower()))
            {
                return(Maze.CellsWithDoors[point]);
            }
            if (Maze.CellsWithKeys.ContainsKey(point) &&
                !KeysCollected.ContainsKey(Maze.CellsWithKeys[point]))
            {
                return(Maze.CellsWithKeys[point]);
            }
            if (CurrentPositions.Contains(point))
            {
                return("@");
            }
            return(".");
        }