コード例 #1
0
    /// <summary>
    /// 공간설정 종료 후 문/창문 설치를 위한 벽(wallTop)과 병합된 바닥 생성.
    /// </summary>
    void MakeWallsAndFloors()
    {
        //테두리 제거
        Transform borders = GameObject.Find("Borders").transform;

        for (int i = 0; i < borders.childCount; i++)
        {
            Destroy(borders.GetChild(i).gameObject);
        }
        foreach (var room in model.Room.Rooms)
        {
            for (int i = 0; i < room.childCount; i++)
            {
                FloatFloor(room.GetChild(i), 0);
            }
        }

        float border = 0.1f;
        float height = 2.2f;

        // 공간설정 완료하고 벽 세우기
        Util.MakeWallTops(model.Room.Rooms, border, height);

        //병합된 바닥 생성하기
        Transform mergedFloorParent = new GameObject().transform;

        mergedFloorParent.parent = model.Room.Rooms[0].parent;
        mergedFloorParent.name   = "MergedRooms";
        int number = 0;

        foreach (var room in model.Room.Rooms)
        {
            GameObject floor = MakeMesh.MakeRoomFloor(Util.GetChildTransform(room), out float area, isDebugMode);
            model.Room.MergedRooms.Add(floor.transform, area);
            if (floor != null)
            {
                floor.name             = "Room" + (number++).ToString();
                floor.transform.parent = mergedFloorParent;
                floor.GetComponent <MeshRenderer>().material = model.Floor.DefaultFloorMaterial;
            }
            room.gameObject.SetActive(false);
        }

        SceneManager.LoadScene("ElementSettingScene");
    }