Дам бесплатный совет, коллега по цеху : ) Гитхаб и код. Программиста оценить можно по коду. ACTORS - мой фреймворк на Unity Until We Die - игра над которой работаю
if (LevelWinCounter == 0) { Console.WriteLine("YOU WIN"); } } }
static void ScreenOutput() { Console.Clear(); for (int y = 0; y < 8; y++) { for (int x = 0; x < 10; x++) { Console.Write(LevelData[y, x]); } Console.WriteLine(""); }
}
static bool ReadKey() { int dx = 0, dy = 0; ConsoleKeyInfo keyinfo = Console.ReadKey(); if (keyinfo.Key == ConsoleKey.W || keyinfo.Key == ConsoleKey.A || keyinfo.Key == ConsoleKey.S || keyinfo.Key == ConsoleKey.D) { switch (keyinfo.Key) { case ConsoleKey.W: dy = -1; break; case ConsoleKey.A: dx = -1; break; case ConsoleKey.S: dy = 1; break; case ConsoleKey.D: dx = 1; break; default: break; }
if (CheckMove(dx, dy)) { MoveObject(dx, dy); };
} if (keyinfo.Key == ConsoleKey.Escape) return false; return true; }
static bool CheckMove(int x, int y) { if (LevelData[playerPOS[1] + y, playerPOS[0] + x] == '▒' || LevelData[playerPOS[1] + y, playerPOS[0] + x] == '▓') { x *= 2; y *= 2; } if (LevelData[playerPOS[1] + y, playerPOS[0] + x] == ' ' || LevelData[playerPOS[1] + y, playerPOS[0] + x] == '░') return true;
return false; }
static void MoveObject(int x, int y) { if (LevelData[playerPOS[1] + y, playerPOS[0] + x] == '▓' || LevelData[playerPOS[1] + y, playerPOS[0] + x] == '▒') {
if (LevelData[playerPOS[1] + y, playerPOS[0] + x] == '▓' && LevelData[playerPOS[1] + y * 2, playerPOS[0] + x * 2] == ' ') LevelWinCounter++; if (LevelData[playerPOS[1] + y, playerPOS[0] + x] == '▒' && LevelData[playerPOS[1] + y * 2, playerPOS[0] + x * 2] == '░') LevelWinCounter--;
if (LevelData[playerPOS[1] + y * 2, playerPOS[0] + x * 2] == '░') LevelData[playerPOS[1] + y * 2, playerPOS[0] + x * 2] = '▓'; else LevelData[playerPOS[1] + y * 2, playerPOS[0] + x * 2] = '▒'; if (LevelData[playerPOS[1] + y, playerPOS[0] + x] == '▓') LevelData[playerPOS[1] + y, playerPOS[0] + x] = '░'; else LevelData[playerPOS[1] + y, playerPOS[0] + x] = ' '; }
if (LevelData[playerPOS[1] + y, playerPOS[0] + x] == '░') LevelData[playerPOS[1] + y, playerPOS[0] + x] = 'O'; else LevelData[playerPOS[1] + y, playerPOS[0] + x] = 'X';