private void Start() { if (Object.op_Inequality((Object)this.gameObjects.waterLens, (Object)null)) { this.waterLensAudio = (AudioSource)this.gameObjects.waterLens.GetComponent <AudioSource>(); } if (Object.op_Inequality((Object)this.gameObjects.airLens, (Object)null)) { this.airLensAudio = (AudioSource)this.gameObjects.airLens.GetComponent <AudioSource>(); } this.audioComp = (AudioSource)((Component)this).GetComponent <AudioSource>(); this.cameraAudio = (AudioSource)this.gameObjects.mainCamera.GetComponent <AudioSource>(); this.bubbleBehaviour = (AQUAS_BubbleBehaviour)this.gameObjects.bubble.GetComponent <AQUAS_BubbleBehaviour>(); if (Object.op_Inequality((Object)this.gameObjects.airLens, (Object)null)) { this.gameObjects.airLens.SetActive(true); } if (Object.op_Inequality((Object)this.gameObjects.waterLens, (Object)null)) { this.gameObjects.waterLens.SetActive(false); } this.waterPlaneMaterial = ((Renderer)this.gameObjects.waterPlanes[0].GetComponent <Renderer>()).get_material(); this.t = this.wetLens.wetTime + this.wetLens.dryingTime; this.t2 = 0.0f; this.bubbleSpawnTimer = 0.0f; this.defaultFog = RenderSettings.get_fog(); this.defaultFogDensity = RenderSettings.get_fogDensity(); this.defaultFogColor = RenderSettings.get_fogColor(); this.defaultFoamContrast = this.waterPlaneMaterial.GetFloat("_FoamContrast"); this.defaultSpecularity = this.waterPlaneMaterial.GetFloat("_Specular"); if (this.waterPlaneMaterial.HasProperty("_Refraction")) { this.defaultRefraction = this.waterPlaneMaterial.GetFloat("_Refraction"); } this.audioComp.set_clip(this.soundEffects.sounds[0]); this.audioComp.set_loop(true); this.audioComp.Stop(); if (Object.op_Inequality((Object)this.airLensAudio, (Object)null)) { this.airLensAudio.set_clip(this.soundEffects.sounds[1]); this.airLensAudio.set_loop(false); this.airLensAudio.Stop(); } if (Object.op_Inequality((Object)this.waterLensAudio, (Object)null)) { this.waterLensAudio.set_clip(this.soundEffects.sounds[2]); this.waterLensAudio.set_loop(false); this.waterLensAudio.Stop(); } if (!Object.op_Inequality((Object)GameObject.Find("Tenkoku DynamicSky"), (Object)null)) { return; } this.tenkokuObj = GameObject.Find("Tenkoku DynamicSky"); }
//<summary> //Initializes the state at start //Grabs the default values and stores them into the appropriate variables //</summary> void Start() { //Set up the post processing on the camera if (gameObjects.mainCamera.GetComponent <PostProcessingBehaviour>() == null) { gameObjects.mainCamera.AddComponent <PostProcessingBehaviour>(); } postProcessing = gameObjects.mainCamera.GetComponent <PostProcessingBehaviour>(); #if UNITY_EDITOR if (underWaterParameters.defaultProfile == null) { EditorUtility.DisplayDialog("WARNING! - Post default post processing profile missing!", "The post processing profiles in the inspector of the underwater camera effects are missing a default profile! It's not recommended to leave the default profile empty. If you don't want to use post processing while afloat, you can use a profile with all image effects disabled", "Got it!"); } #endif waterLensAudio = gameObjects.waterLens.GetComponent <AudioSource>(); airLensAudio = gameObjects.airLens.GetComponent <AudioSource>(); audioComp = GetComponent <AudioSource>(); cameraAudio = gameObjects.mainCamera.GetComponent <AudioSource>(); bubbleBehaviour = gameObjects.bubble.GetComponent <AQUAS_BubbleBehaviour>(); //Set initially active lenses gameObjects.airLens.SetActive(true); gameObjects.waterLens.SetActive(false); //Assign materials //waterLensMaterial = gameObjects.waterLens.GetComponent<Renderer> ().material; airLensMaterial = gameObjects.airLens.GetComponent <Renderer> ().material; waterPlaneMaterial = gameObjects.waterPlanes[0].GetComponent <Renderer> ().material; t = wetLens.wetTime + wetLens.dryingTime; t2 = 0; bubbleSpawnTimer = 0; //Initialize default values for --- //--- global fog defaultFog = RenderSettings.fog; defaultFogDensity = RenderSettings.fogDensity; defaultFogColor = RenderSettings.fogColor; /*if (globalFog != null) * { * globalFog.enabled = defaultFog; * }*/ //--- Some water parameters defaultFoamContrast = waterPlaneMaterial.GetFloat("_FoamContrast"); defaultSpecularity = waterPlaneMaterial.GetFloat("_Specular"); if (waterPlaneMaterial.HasProperty("_Refraction")) { defaultRefraction = waterPlaneMaterial.GetFloat("_Refraction"); } postProcessing.profile = underWaterParameters.defaultProfile; audioComp.clip = soundEffects.sounds[0]; audioComp.loop = true; audioComp.Stop(); airLensAudio.clip = soundEffects.sounds[1]; airLensAudio.loop = false; airLensAudio.Stop(); waterLensAudio.clip = soundEffects.sounds[2]; waterLensAudio.loop = false; waterLensAudio.Stop(); //Check if Tenkoku is in the scene if (GameObject.Find("Tenkoku DynamicSky") != null) { tenkokuObj = GameObject.Find("Tenkoku DynamicSky"); } }
//<summary> //Initializes the state at start //Grabs the default values and stores them into the appropriate variables //</summary> void Start() { //Set up the post processing on the camera #if UNITY_POST_PROCESSING_STACK_V1 if (gameObjects.mainCamera.GetComponent <PostProcessingBehaviour>() == null) { gameObjects.mainCamera.AddComponent <PostProcessingBehaviour>(); } postProcessing = gameObjects.mainCamera.GetComponent <PostProcessingBehaviour>(); #endif #if UNITY_POST_PROCESSING_STACK_V2 && UNITY_EDITOR if (gameObjects.mainCamera.GetComponent <PostProcessLayer>() == null) { EditorUtility.DisplayDialog("No Post Process Layer detected", "The camera object is missing a Post Process Layer and a Post Process Volume. In the Editor AQUAS will try to add them when entering play mode. However it is recommended that you add them manually before entering playmode, or else they will be missing in the build.", "Got It!"); gameObjects.mainCamera.AddComponent <PostProcessLayer>(); postProcessing = gameObjects.mainCamera.GetComponent <PostProcessLayer>(); PostProcessResources resources; if ((PostProcessResources)AssetDatabase.LoadAssetAtPath("Assets/PostProcessing-2/PostProcessing/PostProcessResources.asset", typeof(PostProcessResources)) != null) { resources = (PostProcessResources)AssetDatabase.LoadAssetAtPath("Assets/PostProcessing-2/PostProcessing/PostProcessResources.asset", typeof(PostProcessResources)); } else if ((PostProcessResources)AssetDatabase.LoadAssetAtPath("Assets/PostProcessing/PostProcessResources.asset", typeof(PostProcessResources)) != null) { resources = (PostProcessResources)AssetDatabase.LoadAssetAtPath("Assets/PostProcessing/PostProcessResources.asset", typeof(PostProcessResources)); } else if ((PostProcessResources)AssetDatabase.LoadAssetAtPath("Assets/PostProcessing-2/PostProcessResources.asset", typeof(PostProcessResources)) != null) { resources = (PostProcessResources)AssetDatabase.LoadAssetAtPath("Assets/PostProcessing-2/PostProcessResources.asset", typeof(PostProcessResources)); } else { EditorUtility.DisplayDialog("Could not locate Post Process Resource file.", "Please make sure your post processing folder is at the top level of the assets folder and named either 'PostProcessing' or 'PostProcessing-2'", "Got It!"); resources = null; } postProcessing.Init(resources); postProcessing.volumeTrigger = gameObjects.mainCamera.transform; postProcessing.volumeLayer = LayerMask.NameToLayer("Everything"); } if (gameObjects.mainCamera.GetComponent <PostProcessVolume>() == null) { gameObjects.mainCamera.AddComponent <PostProcessVolume>(); gameObjects.mainCamera.GetComponent <PostProcessVolume>().isGlobal = true; } postProcessingVolume = gameObjects.mainCamera.GetComponent <PostProcessVolume>(); #endif #if UNITY_EDITOR #if UNITY_POST_PROCESSING_STACK_V1 || UNITY_POST_PROCESSING_STACK_V2 if (underWaterParameters.defaultProfile == null) { EditorUtility.DisplayDialog("WARNING! - Post default post processing profile missing!", "The post processing profiles in the inspector of the underwater camera effects are missing a default profile! It's not recommended to leave the default profile empty. If you don't want to use post processing while afloat, you can use a profile with all image effects disabled", "Got it!"); } #endif #endif waterLensAudio = gameObjects.waterLens.GetComponent <AudioSource>(); airLensAudio = gameObjects.airLens.GetComponent <AudioSource>(); audioComp = GetComponent <AudioSource>(); cameraAudio = gameObjects.mainCamera.GetComponent <AudioSource>(); bubbleBehaviour = gameObjects.bubble.GetComponent <AQUAS_BubbleBehaviour>(); //Set initially active lenses gameObjects.airLens.SetActive(true); gameObjects.waterLens.SetActive(false); //Assign materials //waterLensMaterial = gameObjects.waterLens.GetComponent<Renderer> ().material; airLensMaterial = gameObjects.airLens.GetComponent <Renderer> ().material; waterPlaneMaterial = gameObjects.waterPlanes[0].GetComponent <Renderer> ().material; t = wetLens.wetTime + wetLens.dryingTime; t2 = 0; bubbleSpawnTimer = 0; //Initialize default values for --- //--- global fog defaultFog = RenderSettings.fog; defaultFogDensity = RenderSettings.fogDensity; defaultFogColor = RenderSettings.fogColor; /*if (globalFog != null) * { * globalFog.enabled = defaultFog; * }*/ //--- Some water parameters defaultFoamContrast = waterPlaneMaterial.GetFloat("_FoamContrast"); defaultSpecularity = waterPlaneMaterial.GetFloat("_Specular"); if (waterPlaneMaterial.HasProperty("_Refraction")) { defaultRefraction = waterPlaneMaterial.GetFloat("_Refraction"); } #if UNITY_POST_PROCESSING_STACK_V1 postProcessing.profile = underWaterParameters.defaultProfile; #endif #if UNITY_POST_PROCESSING_STACK_V2 postProcessingVolume.profile = underWaterParameters.defaultProfile; #endif audioComp.clip = soundEffects.sounds[0]; audioComp.loop = true; audioComp.Stop(); airLensAudio.clip = soundEffects.sounds[1]; airLensAudio.loop = false; airLensAudio.Stop(); waterLensAudio.clip = soundEffects.sounds[2]; waterLensAudio.loop = false; waterLensAudio.Stop(); //Check if Tenkoku is in the scene if (GameObject.Find("Tenkoku DynamicSky") != null) { tenkokuObj = GameObject.Find("Tenkoku DynamicSky"); } }
//<summary> //Initializes the state at start //Grabs the default values and stores them into the appropriate variables //</summary> void Start() { // Disables Caustics in Unity 2018 to avoid rendering issues - will be removed once it is certain, that there will be no more rendering issues whatsoever. /*#if UNITY_2018 && UNITY_EDITOR * * if (gameObjects.waterPlanes[activePlane].transform.Find("PrimaryCausticsProjector").gameObject.activeSelf || gameObjects.waterPlanes[activePlane].transform.Find("SecondaryCausticsProjector").gameObject.activeSelf) * { * if (EditorUtility.DisplayDialog("Caustics Warning", "You are using Unity 2018. AQUAS is currently experiencing some issues with caustic effects in Unity 2018. It is recommended to keep the caustic projectors disabled until a bugfix is ready. Do you want to disable the caustic projectors?", "Disable Caustics", "Keep Caustics Enabled")) * { * gameObjects.waterPlanes[activePlane].transform.Find("PrimaryCausticsProjector").gameObject.SetActive(false); * gameObjects.waterPlanes[activePlane].transform.Find("SecondaryCausticsProjector").gameObject.SetActive(false); * } * } #endif*/ //Set up the post processing on the camera #if UNITY_POST_PROCESSING_STACK_V1 && !UNITY_POST_PROCESSING_STACK_V2 && AQUAS_PRESENT if (gameObjects.mainCamera.GetComponent <PostProcessingBehaviour>() == null) { gameObjects.mainCamera.AddComponent <PostProcessingBehaviour>(); } postProcessing = gameObjects.mainCamera.GetComponent <PostProcessingBehaviour>(); #endif #if UNITY_EDITOR && AQUAS_PRESENT #endif waterLensAudio = gameObjects.waterLens.GetComponent <AudioSource>(); airLensAudio = gameObjects.airLens.GetComponent <AudioSource>(); audioComp = GetComponent <AudioSource>(); cameraAudio = gameObjects.mainCamera.GetComponent <AudioSource>(); bubbleBehaviour = gameObjects.bubble.GetComponent <AQUAS_BubbleBehaviour>(); //Set initially active lenses gameObjects.airLens.SetActive(true); gameObjects.waterLens.SetActive(false); //Assign materials //waterLensMaterial = gameObjects.waterLens.GetComponent<Renderer> ().material; airLensMaterial = gameObjects.airLens.GetComponent <Renderer> ().material; waterPlaneMaterial = gameObjects.waterPlanes[0].GetComponent <Renderer> ().material; t = wetLens.wetTime + wetLens.dryingTime; t2 = 0; bubbleSpawnTimer = 0; //Initialize default values for --- //--- global fog defaultFog = RenderSettings.fog; defaultFogDensity = RenderSettings.fogDensity; defaultFogColor = RenderSettings.fogColor; /*if (globalFog != null) * { * globalFog.enabled = defaultFog; * }*/ //--- Some water parameters defaultFoamContrast = waterPlaneMaterial.GetFloat("_FoamContrast"); defaultSpecularity = waterPlaneMaterial.GetFloat("_Specular"); if (waterPlaneMaterial.HasProperty("_Refraction")) { defaultRefraction = waterPlaneMaterial.GetFloat("_Refraction"); } #if UNITY_POST_PROCESSING_STACK_V1 && !UNITY_POST_PROCESSING_STACK_V2 && AQUAS_PRESENT postProcessing.profile = underWaterParameters.defaultProfile; #endif audioComp.clip = soundEffects.sounds[0]; audioComp.loop = true; audioComp.Stop(); airLensAudio.clip = soundEffects.sounds[1]; airLensAudio.loop = false; airLensAudio.Stop(); waterLensAudio.clip = soundEffects.sounds[2]; waterLensAudio.loop = false; waterLensAudio.Stop(); //Check if Tenkoku is in the scene if (GameObject.Find("Tenkoku DynamicSky") != null) { tenkokuObj = GameObject.Find("Tenkoku DynamicSky"); } }
//<summary> //Initializes the state at start //Grabs the default values and stores them into the appropriate variables //</summary> void Start() { //Cache referenced components on camera object bloom = gameObjects.mainCamera.GetComponent <Bloom>(); globalFog = gameObjects.mainCamera.GetComponent <GlobalFog>(); blur = gameObjects.mainCamera.GetComponent <BlurOptimized>(); vignette = gameObjects.mainCamera.GetComponent <VignetteAndChromaticAberration>(); noiseAndGrain = gameObjects.mainCamera.GetComponent <NoiseAndGrain>(); sunShafts = gameObjects.mainCamera.GetComponent <SunShafts>(); waterLensAudio = gameObjects.waterLens.GetComponent <AudioSource>(); airLensAudio = gameObjects.airLens.GetComponent <AudioSource>(); audioComp = GetComponent <AudioSource>(); cameraAudio = gameObjects.mainCamera.GetComponent <AudioSource>(); bubbleBehaviour = gameObjects.bubble.GetComponent <AQUAS_BubbleBehaviour>(); //Set initially active lenses gameObjects.airLens.SetActive(true); gameObjects.waterLens.SetActive(false); //Assign materials //waterLensMaterial = gameObjects.waterLens.GetComponent<Renderer> ().material; airLensMaterial = gameObjects.airLens.GetComponent <Renderer> ().material; waterPlaneMaterial = gameObjects.waterPlanes[0].GetComponent <Renderer> ().material; t = wetLens.wetTime + wetLens.dryingTime; t2 = 0; bubbleSpawnTimer = 0; //Initialize default values for --- //--- global fog defaultFog = RenderSettings.fog; defaultFogDensity = RenderSettings.fogDensity; defaultFogColor = RenderSettings.fogColor; /*if (globalFog != null) * { * globalFog.enabled = defaultFog; * }*/ //--- Some water parameters defaultFoamContrast = waterPlaneMaterial.GetFloat("_FoamContrast"); defaultSpecularity = waterPlaneMaterial.GetFloat("_Specular"); if (waterPlaneMaterial.HasProperty("_Refraction")) { defaultRefraction = waterPlaneMaterial.GetFloat("_Refraction"); } //--- image effects (if attached to the camera) if (bloom != null) { defaultBloomIntensity = bloom.bloomIntensity; } if (sunShafts != null) { defaultSunShaftsEnabled = sunShafts.enabled; } if (bloom != null) { defaultBloomEnabled = bloom.enabled; } if (blur != null) { defaultBlurEnabled = blur.enabled; } if (vignette != null) { defaultVignetteEnabled = vignette.enabled; } if (noiseAndGrain != null) { defaultNoiseEnabled = noiseAndGrain.enabled; } audioComp.clip = soundEffects.sounds[0]; audioComp.loop = true; audioComp.Stop(); airLensAudio.clip = soundEffects.sounds[1]; airLensAudio.loop = false; airLensAudio.Stop(); waterLensAudio.clip = soundEffects.sounds[2]; waterLensAudio.loop = false; waterLensAudio.Stop(); //Check if Tenkoku is in the scene if (GameObject.Find("Tenkoku DynamicSky") != null) { tenkokuObj = GameObject.Find("Tenkoku DynamicSky"); } }