Пример #1
0
    void ClearAllRooms()
    {
        foreach (GameObject go in roomList.ToArray())
        {
            roomList.Remove(go);
            Destroy(go);
        }
        roomList.Clear();

        for (int i = 0; i < gridPoints.Length; i++)
        {
            RoomGenerator rG = gridPoints[i].GetComponent <RoomGenerator>();
            rG.ClearAdjacentRoomBools();
            rG.ClearRoomConnections();
        }
    }
Пример #2
0
    IEnumerator ClearRoom(int roomNumber, bool plusCorridors)
    {
        Transform     roomTransform = gridPoints[roomNumber].transform;
        RoomGenerator roomGen       = roomTransform.GetComponent <RoomGenerator>();

        roomGen.ClearAdjacentRoomBools();
        roomGen.ClearRoomConnections();
        roomGen.ClearDoorways();

        roomTransform.GetChild(0).GetComponent <RoomScript>().PrepareForDeletion();
        Destroy(roomTransform.GetChild(0).gameObject);
        //roomTransform.GetChild(0).gameObject.SetActive(false);
        if (plusCorridors)
        {
            while (roomTransform.childCount > 0)
            {
                Destroy(roomTransform.GetChild(0).gameObject);
                yield return(null);
            }
        }
    }