static public bool OnCollisionWalls() { foreach (SnakePoint value in dictionary) { if (WallPointsManager.CheckedList(value.X, value.Y)) { return(true); } } return(false); }
public static void GeneratePoint() { int x, y; Random random = new Random(); x = random.Next(1, WallPointsManager.Width - 1); y = random.Next(1, WallPointsManager.Height - 1); if (!SnakePointsManager.CheckedList(x, y) && !WallPointsManager.CheckedList(x, y) && !CheckedList(x, y)) { FruitPoint fruitPoint = new FruitPoint(x, y); } else { GeneratePoint(); } }
static public void StartGame() { WallPointsManager.BuildSceneWalls(0, 0, 79, 79); SnakePointsManager.StartGame(10, 40); WallPointsManager.ShowSceneWalls(); Console.ForegroundColor = ConsoleColor.Red; ShowLabel("Нажмите \"Escape\" чтобы начать игру", 20, 20); ShowLabel("Чтобы поставить игру на паузу нажмите \"Escape\"", 20, 21); ShowLabel("Чтобы убрать паузу нажмите \"Escape\"", 20, 22); ShowLabel("Чтобы принудительно закончить игру нажмите \"Space\"", 20, 23); Console.SetWindowSize(79, 79); Console.SetWindowPosition(0, 0); Console.SetBufferSize(79, 79); while (Console.ReadKey(true).Key != ConsoleKey.Escape) { } pause = !pause; ShowLabel(" ", 20, 20); ShowLabel(" ", 20, 21); ShowLabel(" ", 20, 22); ShowLabel(" ", 20, 23); FruitPointManager.GenerateFruits(); FruitPointManager.ShowSceneFruit(); }
public WallPoint(int x, int y) { this.X = x; this.Y = y; WallPointsManager.AddInList(this); }