private void OnEnable() { if (WeatherMakerScript.Instance == null) { return; } WeatherMakerScript.EnsureInstance(this, ref instance); if (WeatherMakerCommandBufferManagerScript.Instance != null) { WeatherMakerCommandBufferManagerScript.Instance.RegisterPreCull(CameraPreCull, this); WeatherMakerCommandBufferManagerScript.Instance.RegisterPreRender(CameraPreRender, this); WeatherMakerCommandBufferManagerScript.Instance.RegisterPostRender(CameraPostRender, this); } skySphereMaterial.Update(MeshRenderer.sharedMaterial); if (SkySphereProfile == null) { SkySphereProfile = WeatherMakerScript.Instance.LoadResource <WeatherMakerSkyProfileScript>("WeatherMakerSkyProfile_Procedural"); } if (SkySphereProfile.AtmosphereProfile == null) { SkySphereProfile.AtmosphereProfile = WeatherMakerScript.Instance.LoadResource <WeatherMakerAtmosphereProfileScript>("WeatherMakerAtmosphereProfile_Default"); } if (SkySphereProfile.AtmosphereProfile != null) { SkySphereProfile.AtmosphereProfile.UpdateShaderVariables(null, AtmosphereLookupMaterial, AtmosphereComputeShader); } }
protected override void Start() { base.Start(); if (SkySphereProfile == null) { SkySphereProfile = Resources.Load <WeatherMakerSkyProfileScript>("WeatherMakerSkyProfile_Procedural"); } }
public static WeatherMakerProfileScript OverrideProfile ( WeatherMakerProfileScript profile, WeatherMakerCloudProfileScript cloudProfile, WeatherMakerSkyProfileScript skyProfile, WeatherMakerAuroraProfileScript auroraProfile, WeatherMakerPrecipitationProfileScript precipitationProfile, WeatherMakerFullScreenFogProfileScript fogProfile, WeatherMakerWindProfileScript windProfile, WeatherMakerLightningProfileScript lightningProfile, WeatherMakerSoundProfileScript soundProfile, RangeOfFloats transitionDuration, RangeOfFloats holdDuration ) { if (profile == null) { Debug.LogError("Null profile in Weather Maker profile OverrideProfile, this is not allowed"); return(null); } // check for overrides, if so clone the profile else if (cloudProfile != null || skyProfile != null || auroraProfile != null || precipitationProfile != null || fogProfile != null || windProfile != null || lightningProfile != null || soundProfile != null || transitionDuration.Maximum > 0.0f || holdDuration.Maximum > 0.0f) { if (profile.name.IndexOf("(clone)", System.StringComparison.OrdinalIgnoreCase) < 0) { profile = ScriptableObject.Instantiate(profile); } AssignOverride(ref profile.CloudProfile, cloudProfile); AssignOverride(ref profile.SkyProfile, skyProfile); AssignOverride(ref profile.AuroraProfile, auroraProfile); AssignOverride(ref profile.PrecipitationProfile, precipitationProfile); AssignOverride(ref profile.FogProfile, fogProfile); AssignOverride(ref profile.WindProfile, windProfile); AssignOverride(ref profile.LightningProfile, lightningProfile); AssignOverride(ref profile.SoundProfile, soundProfile); if (transitionDuration.Maximum > 0.0f) { profile.TransitionDuration = transitionDuration; } if (holdDuration.Maximum > 0.0f) { profile.HoldDuration = holdDuration; } } return(profile); }