public Map(Wall levelWall,int numberColumns,int numberLines) { this._numberColumns = numberColumns; this._numberLines = numberLines; this._levelWall = levelWall; this._levelFood = InitialiazeFood(); }
public void EatFood(Food levelFood) { foreach (Point foodCoordinate in levelFood.FoodCoordinates) { if (foodCoordinate == _pacManCoordinate) { levelFood.FoodCoordinates.Remove(foodCoordinate); break; } } }
private Food InitialiazeFood() { Point foodCoordinate = new Point(); Food result = new Food(); for (int j = 0; j < _numberColumns; j++) { for (int k = 0; k < _numberLines; k++) { if (IsFood(foodCoordinate)) { result.Add(foodCoordinate); } foodCoordinate.Y = foodCoordinate.Y + GameSettings.CellSize; } foodCoordinate.Y = 0; foodCoordinate.X = foodCoordinate.X + GameSettings.CellSize; } return result; }