예제 #1
0
        public static Volume Create(Transform transform)
        {
            HUtils.log();
            Debug.Log("Create(Transform transform) transform=" + transform.name);
#if UNITY_EDITOR
            Debug.Log("这里是Volume.cs UNITY_EDITOR存在");
            GameObject newVolumeGO = new GameObject("Volume");
            UnityEditor.Undo.RegisterCreatedObjectUndo(newVolumeGO, "Created Volume GameObject");
            UnityEditor.Undo.SetTransformParent(newVolumeGO.transform, transform, "Parent New Volume GameObject");
            newVolumeGO.transform.localPosition = Vector3.zero;
            newVolumeGO.transform.localRotation = Quaternion.identity;

            Volume output = UnityEditor.Undo.AddComponent <Volume>(newVolumeGO);
            output._visualPart = VisualPart.Create(newVolumeGO.transform, "Volume Visual");

            output._prefabs = new GameObject("Prefabs");
            UnityEditor.Undo.RegisterCreatedObjectUndo(output._prefabs, "Created Volume Prefab GameObject");
            UnityEditor.Undo.SetTransformParent(output._prefabs.transform, newVolumeGO.transform, "Parent New Volume Prefab GameObject");

            output.CheckInternalFloorplans();

            return(output);
#else
            Debug.Log("这里是Volume.cs UNITY_EDITOR不存在");

            GameObject newFloorplanGo = new GameObject("Volume");
            newFloorplanGo.transform.parent = transform;

            Volume output = newFloorplanGo.AddComponent <Volume>();
            output._visualPart = VisualPart.Create(newFloorplanGo.transform, "Volume Visual");

            return(output);
#endif
        }
예제 #2
0
        public static Floorplan Create(Transform transform)
        {
#if UNITY_EDITOR
            GameObject newFloorplanGo = new GameObject("Floorplan");
            UnityEditor.Undo.RegisterCreatedObjectUndo(newFloorplanGo, "Created Floorplan GameObject");
            UnityEditor.Undo.SetTransformParent(newFloorplanGo.transform, transform, "Parent New Floorplan GameObject");
            newFloorplanGo.transform.localPosition = Vector3.zero;
            newFloorplanGo.transform.localRotation = Quaternion.identity;

            Floorplan output = UnityEditor.Undo.AddComponent <Floorplan>(newFloorplanGo);
            output._visualPart = VisualPart.Create(newFloorplanGo.transform, "Floorplan Visual");

            return(output);
#else
            GameObject newFloorplanGo = new GameObject("Interior Floorplan");
            newFloorplanGo.transform.parent = transform;

            Floorplan output = newFloorplanGo.AddComponent <Floorplan>();
            output._visualPart = VisualPart.Create(newFloorplanGo.transform, "Interior Floorplan Visual");
            return(output);
#endif
        }