private void GetLevel() { levelData = levelGenerator.BuildLevelData(); grid = levelData.data; rootNode = null; while (rootNode == null) { rootNode = grid.GetNode(ExtensionMethods.ToEvenGridPosition(Random.Range(0, grid.Width), 1), ExtensionMethods.ToEvenGridPosition(Random.Range(0, grid.Height), 1)); if (rootNode.Data != NodeState.Empty) { rootNode = null; } } print(rootNode.position.x + " " + rootNode.position.y); BuildPath(ref grid, rootNode, 0); PlaceDoors(); rootNode.Reduce(ref grid, NodeState.Door, NodeState.Empty); SetBlocks(); //InitDebugTexture(); OnComplete.Invoke(); }