public void print(Player player, Enemy enemy, int difficult) { int x = Ranges.getSize().x; int y = Ranges.getSize().y; for (int i = 0; i < y; i++) { for (int j = 0; j < x; j++) { if (i == player.Coord.y && j == player.Coord.x) { Console.ForegroundColor = ConsoleColor.White; Console.Write(player.sym); } else { if ((enemy.Coord.x == j && enemy.Coord.y == i && difficult == 1) || (difficult == 2 && enemy.Coord.y >= player.Coord.y - 1 && enemy.Coord.y <= player.Coord.y + 1 && enemy.Coord.x >= player.Coord.x - 1 && enemy.Coord.x <= player.Coord.x + 1 && enemy.Coord.x == j && enemy.Coord.y == i)) { Console.ForegroundColor = ConsoleColor.Red; Console.Write(enemy.sym); } else { switch (difficult) { case 1: printSym(gameField[i, j].sym); break; case 2: if (i >= player.Coord.y - 1 && i <= player.Coord.y + 1 && j >= player.Coord.x - 1 && j <= player.Coord.x + 1) { printSym(gameField[i, j].sym); } else { Console.Write(" "); } break; } } } } Console.WriteLine(); } player.printBackpack(COLS); }
public char[,] convert() { int x = Ranges.getSize().x; int y = Ranges.getSize().y; matrix = new char[x, y]; for (int i = 0; i < y; i++) { for (int j = 0; j < x; j++) { matrix[i, j] = gameField[i, j].sym; } } return(matrix); }
public Matrix(Element element) { matrix = new Element[Ranges.getSize().x, Ranges.getSize().y]; }