public static void CheckedList(int x, int y, out FruitPoint fruitPoint, out int thisElement) { for (int i = 0; i < dictionary.Count; i++) { if (dictionary[i].X == x && dictionary[i].Y == y) { fruitPoint = dictionary[i]; thisElement = i; return; } } fruitPoint = null; thisElement = 0; }
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(); } }
public static void AddInList(FruitPoint thisObject) { dictionary.Add(thisObject); }
public static void AddFruitElement(int x, int y) { FruitPoint fruitPoint = new FruitPoint(x, y); }