protected override void StartGenerate() { m_tree = new BSPTree(m_mapSize, m_minBSPSize, m_minRoomSizeRatio); for (int i = 0; i < m_splitIteration; i++) { m_tree.Split(); } m_leafNodes = m_tree.GetAllLeafNodes(); for (int i = 0; i < m_leafNodes.Count; i++) { m_leafNodes[i].GenerateRoomRect(); } List <BSPNode> levelNodes = null; for (int i = m_splitIteration; i >= 0; i--) { levelNodes = m_tree.GetNodesByLevel(i); for (int j = 0; j < levelNodes.Count; j++) { levelNodes[j].GenerateCorridorRect(); } } m_parentNodes = m_tree.GetAllParentNodes(); if (m_generateObjects) { List <Room> rooms = new List <Room>(); for (int i = 0; i < m_leafNodes.Count; i++) { if (m_leafNodes[i].Room == null) { continue; } rooms.Add(m_leafNodes[i].Room); } List <Corridor> corridors = new List <Corridor>(); for (int i = 0; i < m_parentNodes.Count; i++) { if (m_parentNodes[i].Corridor == null) { continue; } corridors.Add(m_parentNodes[i].Corridor); } GenerateObjects(rooms.ToArray(), corridors.ToArray()); } }