private TerrainChunk BuildNextChunk() { if (chunkLeftEdge == null) { chunkLeftEdge = new Vector2[0]; } Vector2[] verts = GetNextLinearChunkVertices(ref chunkLeftEdge, GetNextLinearCenter(generationOrigin, maxChunkIndex), DO_RANDOM_CHUNK_EDGES); TerrainChunk tempChunk = CreateChunk(verts, maxChunkIndex); // If this is the very first chunk if (maxChunkIndex == 0) { startingChunk = tempChunk; if (pointsOfInterest.Count > 0) { // TODO: slest which poi to spawn (not 0, thats the tutorial priest) tempChunk.AddPointOfInterest(pointsOfInterest[0]); } } else { TerrainChunk previous = startingChunk.GetRightmostChunk(); tempChunk.SetLeftChunk(previous); previous.SetRightChunk(tempChunk); // Handle spawning of points of interest if (pointsOfInterest.Count > 0) { // TODO: select which poi to spawn (not 0, thats the tutorial priest) tempChunk.AddPointOfInterest(pointsOfInterest[1]); } } maxChunkIndex += 1; return(tempChunk); }