public Chunk <Cell> GenerateChunk(Vector2i position) { var chunk = new Chunk <Cell>(); var size = Chunk <Cell> .SIZE; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { chunk.Grid[i, j] = new Cell(); if (randomizer.Next(0, 25000) == 0) { var foodPile = ObjectsFactory.CreateFoodPile(); chunk.Grid[i, j].Item = foodPile; float posX = i + position.X * size; float posY = j + position.Y * size; foodPile.Position = new Vector2f(posX, posY); engine.Register(foodPile); } } } return(chunk); }