private Level LoadLevelFromTemplate(int number) { LevelTemplate levelTemplate = levelTemplates[number]; List <Vertex> vertices = new List <Vertex>(); foreach (float[] vertex in levelTemplate.GetVertices()) { vertices.Add(new Vertex(InstantiateVertex(vertex[0], vertex[1]))); } foreach (int[] edge in levelTemplate.GetEdges()) { CreateEdge(vertices[edge[0]], vertices[edge[1]]); } Graph graph = new Graph(vertices); return(new Level(number, graph, calculateBorder(levelTemplate.GetVertices()))); }