コード例 #1
0
        public void OnEnable()
        {
            //Get Gaia Lighting Profile object
            m_profile = (GaiaLightingProfile)target;

            if (m_editorUtils == null)
            {
                // Get editor utils for this
                m_editorUtils = PWApp.GetEditorUtils(this);
            }

            if (m_gaiaSettings == null)
            {
                m_gaiaSettings = GaiaUtils.GetGaiaSettings();
            }

            m_renderPipeline = m_gaiaSettings.m_pipelineProfile.m_activePipelineInstalled;
            m_version        = PWApp.CONF.Version;

            if (m_profile != null)
            {
                m_profileValues = m_profile.m_lightingProfiles[m_profile.m_selectedLightingProfileValuesIndex];
            }

            enableEditMode = System.IO.Directory.Exists(GaiaUtils.GetAssetPath("Dev Utilities"));
        }
コード例 #2
0
        public void LoadCaustics()
        {
            #if UNITY_EDITOR
            m_cookies     = new Texture2D[16];
            m_cookies[0]  = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_001.tif"));
            m_cookies[1]  = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_002.tif"));
            m_cookies[2]  = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_003.tif"));
            m_cookies[3]  = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_004.tif"));
            m_cookies[4]  = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_005.tif"));
            m_cookies[5]  = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_006.tif"));
            m_cookies[6]  = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_007.tif"));
            m_cookies[7]  = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_008.tif"));
            m_cookies[8]  = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_009.tif"));
            m_cookies[9]  = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_010.tif"));
            m_cookies[10] = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_011.tif"));
            m_cookies[11] = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_012.tif"));
            m_cookies[12] = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_013.tif"));
            m_cookies[13] = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_014.tif"));
            m_cookies[14] = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_015.tif"));
            m_cookies[15] = AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_016.tif"));

            m_submergeSoundFXDown     = AssetDatabase.LoadAssetAtPath <AudioClip>(GaiaUtils.GetAssetPath("Gaia Ambient Submerge Down.mp3"));
            m_submergeSoundFXUp       = AssetDatabase.LoadAssetAtPath <AudioClip>(GaiaUtils.GetAssetPath("Gaia Ambient Submerge Up.mp3"));
            underwaterParticlesStored = AssetDatabase.LoadAssetAtPath <GameObject>(GaiaUtils.GetAssetPath("Underwater Particles Effects.prefab"));
            horizonObjectStored       = AssetDatabase.LoadAssetAtPath <GameObject>(GaiaUtils.GetAssetPath("Ambient Underwater Horizon.prefab"));
            #endif
        }
コード例 #3
0
        /// <summary>
        /// Starting function setup
        /// </summary>
        void Start()
        {
            storedColor = m_uiTextColor;

            if (m_textContent != null)
            {
                m_textContent.color = storedColor;

#if UNITY_EDITOR
                if (!m_textContent.text.Contains("Open the Location Manager"))
                {
                    string locationProfilePath = GaiaUtils.GetAssetPath("Location Profile.asset");
                    if (!string.IsNullOrEmpty(locationProfilePath))
                    {
                        LocationSystemScriptableObject locationProfile = AssetDatabase.LoadAssetAtPath <LocationSystemScriptableObject>(locationProfilePath);
                        if (locationProfile != null)
                        {
                            m_textContent.text += "\r\n\r\nOpen the Location Manager from the Advanced Tab in the Gaia Manager to bookmark interesting locations:\r\n";
                            m_textContent.text += string.Format("{0} + {1} (new bookmark), {0} + {2} / {3} (cycle bookmarks)", locationProfile.m_mainKey.ToString(), locationProfile.m_addBookmarkKey.ToString(), locationProfile.m_prevBookmark.ToString(), locationProfile.m_nextBookmark.ToString());
                            m_textContent.text += "\r\n\r\n";
                        }
                    }
                }
#endif
            }
        }
コード例 #4
0
        public void LoadUnderwaterSystemAssets()
        {
#if UNITY_EDITOR
            Camera camera = GaiaUtils.GetCamera();
            if (camera != null)
            {
                m_playerCamera = camera.transform;
            }

            if (m_causticTextures == null || m_causticTextures.Count <= 0)
            {
                m_causticTextures = new List <Texture2D>
                {
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_001.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_002.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_003.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_004.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_005.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_006.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_007.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_008.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_009.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_010.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_011.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_012.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_013.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_014.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_015.tif")),
                    AssetDatabase.LoadAssetAtPath <Texture2D>(GaiaUtils.GetAssetPath("CausticsRender_016.tif"))
                };
            }

            if (m_submergeSoundFXDown == null)
            {
                m_submergeSoundFXDown = AssetDatabase.LoadAssetAtPath <AudioClip>(GaiaUtils.GetAssetPath("Gaia Ambient Submerge Down.mp3"));
            }

            if (m_submergeSoundFXUp == null)
            {
                m_submergeSoundFXUp = AssetDatabase.LoadAssetAtPath <AudioClip>(GaiaUtils.GetAssetPath("Gaia Ambient Submerge Up.mp3"));
            }

            if (m_underwaterSoundFX == null)
            {
                m_underwaterSoundFX = AssetDatabase.LoadAssetAtPath <AudioClip>(GaiaUtils.GetAssetPath("Gaia Ambient Underwater Sound Effect.mp3"));
            }

            if (m_fogColorGradient == null)
            {
                m_fogColorGradient = CreateGradient();
            }
#endif
        }
コード例 #5
0
        private void OnEnable()
        {
            //Get Gaia Lighting Profile object
            m_profile = (GaiaMaintenanceProfile)target;
            if (m_editorUtils == null)
            {
                // Get editor utils for this
                m_editorUtils = PWApp.GetEditorUtils(this);
            }

            m_enableEditMode = System.IO.Directory.Exists(GaiaUtils.GetAssetPath("Dev Utilities"));
        }
コード例 #6
0
        public Transform GetThePlayer()
        {
            #if UNITY_EDITOR
            GaiaSettings settings  = AssetDatabase.LoadAssetAtPath <GaiaSettings>(GaiaUtils.GetAssetPath("GaiaSettings.asset"));
            Transform    thePlayer = null;
            if (settings.m_currentController == GaiaConstants.EnvironmentControllerType.FirstPerson)
            {
                if (GameObject.Find("FirstPersonCharacter") != null)
                {
                    thePlayer = GameObject.Find("FirstPersonCharacter").transform;

                    if (thePlayer != null)
                    {
                        return(thePlayer);
                    }
                }
            }

            if (settings.m_currentController == GaiaConstants.EnvironmentControllerType.FlyingCamera)
            {
                if (GameObject.Find("FlyCam") != null)
                {
                    thePlayer = GameObject.Find("FlyCam").transform;

                    if (thePlayer != null)
                    {
                        return(thePlayer);
                    }
                }
            }

            if (settings.m_currentController == GaiaConstants.EnvironmentControllerType.ThirdPerson)
            {
                if (GameObject.Find("Main Camera") != null)
                {
                    thePlayer = GameObject.Find("Main Camera").transform;

                    if (thePlayer != null)
                    {
                        return(thePlayer);
                    }
                }
            }
            #endif
            return(null);
        }
コード例 #7
0
        public override void OnInspectorGUI()
        {
            if (m_profile == null)
            {
                m_profile = (SceneProfile)target;
            }

            m_helpBoxStyle = SetupHelpBoxStyle();
            EditorGUILayout.LabelField(m_sceneProfileContext1 + "<b>" + m_profile.m_savedFromScene + "</b>" + m_sceneProfileContext2, m_helpBoxStyle);
            if (GUILayout.Button(new GUIContent("Open Source Scene", "This will open the scene where this profile was created from. The scene where this was saved from is shown in Bold in the text above.")))
            {
                string sceneToOpen = GaiaUtils.GetAssetPath(m_profile.m_savedFromScene + ".unity");
                if (!string.IsNullOrEmpty(sceneToOpen))
                {
                    LoadSourceScene(sceneToOpen);
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// Select or create a scanner
        /// </summary>
        public static GameObject CreateScanner()
        {
            GameObject gaiaObj    = GaiaUtils.GetGaiaGameObject();
            GameObject scannerObj = GameObject.Find("Scanner");

            if (scannerObj == null)
            {
                scannerObj = new GameObject("Scanner");
                scannerObj.transform.parent = gaiaObj.transform;
                GaiaSceneInfo sceneInfo = null;
                if (Terrain.activeTerrains.Length > 0)
                {
                    sceneInfo = GaiaSceneInfo.GetSceneInfo();
                }
                if (sceneInfo != null)
                {
                    Vector3 position = scannerObj.transform.position;
                    position.y = sceneInfo.m_seaLevel;
                    scannerObj.transform.position = position;
                }
                else
                {
                    scannerObj.transform.position = new Vector3(0f, 50f, 0f);
                }
                Scanner scanner = scannerObj.AddComponent <Scanner>();

                #if UNITY_EDITOR
                //Load the material to draw it
                string matPath = GaiaUtils.GetAssetPath("GaiaScannerMaterial.mat");
                if (!string.IsNullOrEmpty(matPath))
                {
                    scanner.m_previewMaterial = AssetDatabase.LoadAssetAtPath <Material>(matPath);
                }
                #endif
            }
            return(scannerObj);
        }
コード例 #9
0
        private void Setup(bool helpEnabled)
        {
            m_profile.m_locationProfile = (LocationSystemScriptableObject)m_editorUtils.ObjectField("LocationProfile", m_profile.m_locationProfile, typeof(LocationSystemScriptableObject), false, helpEnabled);
            if (m_profile.m_locationProfile == null)
            {
                m_profile.m_locationProfile = AssetDatabase.LoadAssetAtPath <LocationSystemScriptableObject>(GaiaUtils.GetAssetPath("Location Profile.asset"));
            }

            if (m_profile.m_camera == null)
            {
                EditorGUILayout.BeginHorizontal();
                m_profile.m_camera = (Transform)m_editorUtils.ObjectField("Camera", m_profile.m_camera, typeof(Transform), true, helpEnabled);
                if (m_editorUtils.Button("FindCamera", GUILayout.MaxWidth(50f)))
                {
                    Camera locatedCam = GaiaUtils.GetCamera();
                    if (locatedCam != null)
                    {
                        m_profile.m_camera = locatedCam.transform;
                    }
                    else
                    {
                        Debug.LogWarning("No camera could be found in your scene please add one from the GameObject/Camera in the top toolbar.");
                    }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.HelpBox("A camera transform must be provided for Location Manager to work. You can press 'Find' button to quickly locate the camera in the scene.", MessageType.Warning);
            }
            else
            {
                m_profile.m_camera = (Transform)m_editorUtils.ObjectField("Camera", m_profile.m_camera, typeof(Transform), true, helpEnabled);
            }

            m_profile.m_player = (Transform)m_editorUtils.ObjectField("Player", m_profile.m_player, typeof(Transform), true, helpEnabled);

            m_profile.m_trackPlayer = m_editorUtils.Toggle("TrackPlayer", m_profile.m_trackPlayer, helpEnabled);
        }
コード例 #10
0
 private void Initilize()
 {
     if (m_locationProfile == null)
     {
         #if UNITY_EDITOR
         m_locationProfile = UnityEditor.AssetDatabase.LoadAssetAtPath <LocationSystemScriptableObject>(GaiaUtils.GetAssetPath("Location Profile.asset"));
         #endif
     }
 }