void Draw() { if (snake.body[0].Equals(food.body)) { Sound(); snake.body.Add(food.body); bool ok = false; while (!ok) { bool ok1 = false; Point f = food.Generate(); foreach (Point p1 in snake.body) { if (f.Equals(p1)) { ok1 = false; break; } ok1 = true; foreach (Point p2 in wall.body) { if (f.Equals(p2)) { ok1 = false; break; } ok1 = true; } } ok = ok1; food.body = f; } food.Draw(); score += ShowSpeed; } else { foreach (Point p in wall.body) { if (snake.body[0].Equals(p)) { snake.IsAlive = false; break; } } foreach (Point p in snake.body) { if (p != snake.body[0] && p.Equals(snake.body[0])) { snake.IsAlive = false; break; } } } if (!snake.IsAlive) { return; } if (score >= (currentLevel + 1) * 25) { currentLevel++; wall.Clear(); wall.LoadLevel(currentLevel); snake.Clear2(); snake.body.Clear(); food.Clear(); snake.body.Add(new Point { X = 35, Y = 11, Sign = '█' }); snake.Draw(); bool ok = false; while (!ok) { bool ok1 = false; Point f = food.Generate(); foreach (Point p1 in snake.body) { if (f.Equals(p1)) { ok1 = false; break; } ok1 = true; foreach (Point p2 in wall.body) { if (f.Equals(p2)) { ok1 = false; break; } ok1 = true; } } ok = ok1; food.body = f; } food.Draw(); wall.Draw(); snake.Draw(); snake.ChangeDirection(Console.ReadKey()); } snake.Draw(); StatusBar(); }