예제 #1
0
        // ReSharper disable once UnusedMember.Local
        public static void AddVegetationStudioManager()
        {
            VegetationStudioManager vegetationStudioManager = FindObjectOfType <VegetationStudioManager>();

            if (vegetationStudioManager)
            {
                EditorUtility.DisplayDialog("Vegetation Studio Pro Component",
                                            "There is already a Vegetation Studio Pro Manager Component in the scene. There can be only one.",
                                            "OK");
            }
            else
            {
                GameObject go = new GameObject {
                    name = "VegetationStudioPro"
                };
                go.AddComponent <VegetationStudioManager>();

                GameObject vegetationSystem = new GameObject {
                    name = "VegetationSystemPro"
                };
                vegetationSystem.transform.SetParent(go.transform);
                VegetationSystemPro vegetationSystemPro = vegetationSystem.AddComponent <VegetationSystemPro>();
                vegetationSystem.AddComponent <TerrainSystemPro>();
                vegetationSystemPro.AddAllUnityTerrains();

#if TOUCH_REACT
                GameObject touchReactSystem = new GameObject {
                    name = "TouchReactSystem"
                };
                touchReactSystem.transform.SetParent(go.transform);
                touchReactSystem.AddComponent <TouchReactSystem>();
#endif
                vegetationSystem.AddComponent <ColliderSystemPro>();
                vegetationSystem.AddComponent <PersistentVegetationStorage>();
                RuntimePrefabSpawner runtimePrefabSpawner = vegetationSystem.AddComponent <RuntimePrefabSpawner>();
                runtimePrefabSpawner.enabled = false;
            }
        }
    void ConnectToCTI_VSP(CTSProfile profile, VegetationPackagePro PackagePro)
    {
        CTSTerrainManager.Instance.AddCTSToAllTerrains();
        CTSTerrainManager.Instance.BroadcastProfileSelect(profile);

        VegetationStudioManager vegetationStudioManager = FindObjectOfType <VegetationStudioManager>();

        if (!vegetationStudioManager)
        {
            GameObject go = new GameObject {
                name = "VegetationStudioPro"
            };
            go.AddComponent <VegetationStudioManager>();

            GameObject vegetationSystem = new GameObject {
                name = "VegetationSystemPro"
            };
            vegetationSystem.transform.SetParent(go.transform);
            VSP = vegetationSystem.AddComponent <VegetationSystemPro>();
            vegetationSystem.AddComponent <TerrainSystemPro>();
            VSP.AddAllUnityTerrains();
            VSP.AddVegetationPackage(PackagePro);
            PackagePro.SetupTerrainTextureSettings();

        #if TOUCH_REACT
            GameObject touchReactSystem = new GameObject {
                name = "TouchReactSystem"
            };
            touchReactSystem.transform.SetParent(go.transform);
            touchReactSystem.AddComponent <TouchReactSystem>();
        #endif
            vegetationSystem.AddComponent <ColliderSystemPro>();
            vegetationSystem.AddComponent <PersistentVegetationStorage>();
            RuntimePrefabSpawner runtimePrefabSpawner = vegetationSystem.AddComponent <RuntimePrefabSpawner>();
            runtimePrefabSpawner.enabled = false;
        }
    }