Exemple #1
0
    public static EnhancedFogSettings GetOrCreateFogSettings(string scenePath)
    {
        EnhancedFogSettings loadedFogSettings = EnhancedFogLoader.GetFogSettings(scenePath);

        if (!loadedFogSettings)
        {
            if (EnhancedFogSettingsProvider.autoGenerateFogSettings)
            {
                loadedFogSettings = EnhancedFogLoader.CreateFogSettings(scenePath);
            }
            else
            {
                loadedFogSettings = ScriptableObject.CreateInstance(typeof(EnhancedFogSettings)) as EnhancedFogSettings;
            }
        }

        return(loadedFogSettings);
    }
Exemple #2
0
    public static void OnPostprocessScene()
    {
        Scene scene = SceneManager.GetActiveScene();

        if (scene.buildIndex == 0)
        {
            GameObject go = new GameObject();
            go.name = "EnhancedFogSettingsContainer";
            EnhancedFogSettingsContainer fogSettingsContainer = go.AddComponent <EnhancedFogSettingsContainer>();

            EditorBuildSettingsScene[] buildScenes = EditorBuildSettings.scenes;

            int buildScenesCount = buildScenes.Length;
            for (int i = 0; i < buildScenesCount; i++)
            {
                string scenePath = buildScenes[i].path;
                Debug.Log("OnPostProcessScene: Getting fog settings at scene path = " + scenePath);
                fogSettingsContainer.fogSettings.Add(EnhancedFogLoader.GetFogSettings(scenePath));
            }
        }
    }
Exemple #3
0
    private void Initialize(Scene scene)
    {
        fogSettings  = EnhancedFogLoader.GetFogSettings(scene);
        currentScene = scene;

        if (!fogSettings)
        {
            fogSettingsNotFoundOnDisk = true;
            fogSettings                 = ScriptableObject.CreateInstance(typeof(EnhancedFogSettings)) as EnhancedFogSettings;
            fogSettings.isEnabled       = EnhancedFog.isEnabled;
            fogSettings.colorMode       = EnhancedFog.colorMode;
            fogSettings.color           = EnhancedFog.color;
            fogSettings.gradient        = EnhancedFog.gradient;
            fogSettings.gradientTexture = EnhancedFog.gradientTexture;
            fogSettings.mode            = EnhancedFog.mode;
            fogSettings.startDistance   = EnhancedFog.startDistance;
            fogSettings.endDistance     = EnhancedFog.endDistance;
            fogSettings.density         = EnhancedFog.density;
        }
        else
        {
            fogSettingsNotFoundOnDisk = false;
        }

        isEnabled       = fogSettings.isEnabled;
        colorMode       = fogSettings.colorMode;
        color           = fogSettings.color;
        gradient        = fogSettings.gradient;
        gradientTexture = fogSettings.gradientTexture;
        mode            = fogSettings.mode;
        startDistance   = fogSettings.startDistance;
        endDistance     = fogSettings.endDistance;
        density         = fogSettings.density;

        unityLogo = EditorGUIUtility.IconContent("BuildSettings.Editor.Small").image;
        string headerText = string.Join(blankspace, blankspace + scene.name, fogSettingsText);

        headerContent = new GUIContent(headerText, unityLogo, "");
    }