void AddVerticesFromArray(float[] points) { float offsetPos = listOfVertices[listOfVertices.Count - 1].x; float posY; float posZ = 0; float posX = offsetPos; for (int i = 0; i < points.Length; i++) { posY = (points[i] + 1) / 2 * (UPPER_BOUND - LOWER_BOUND) - LOWER_BOUND; posX += DISTANCE; if (spawner.ShouldGenerateHere(posX + transform.position.x)) { spawner.GenerateObstacleHere(posX + transform.position.x, posY, posY + MAP_HEIGHT); } listOfVertices.Add(new Vector3(posX, posY, posZ)); } }