void SyncDataFromSkyProfile() { m_LightningProbability = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.LightningProbabilityKey, m_TimeOfDay); m_LightningIntensity = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.LightningIntensityKey, m_TimeOfDay); m_SpawnCoolDown = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.LightningStrikeCoolDown, m_TimeOfDay); m_ThunderSoundDelay = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.ThunderSoundDelayKey, m_TimeOfDay); // Scale the probability for this art style. m_LightningProbability *= m_Style.strikeProbability; m_LightningIntensity *= m_Style.intensity; m_SpriteSheetLayout.columns = m_Style.columns; m_SpriteSheetLayout.rows = m_Style.rows; m_SpriteSheetLayout.frameCount = m_Style.totalFrames; m_SpriteSheetLayout.frameRate = m_Style.animateSpeed; m_SpriteTexture = m_Style.spriteSheetTexture; m_TintColor = m_Style.tintColor * m_SkyProfile.GetColorPropertyValue(ProfilePropertyKeys.LightningTintColorKey, m_TimeOfDay); modelMesh = m_Style.mesh; renderMaterial = new Material(m_Style.material); }
void SyncDataFromSkyProfile() { maxSprites = (int)m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainSplashMaxConcurrentKey, m_TimeOfDay); m_SplashAreaStart = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainSplashAreaStartKey, m_TimeOfDay); m_SplashAreaLength = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainSplashAreaLengthKey, m_TimeOfDay); m_SplashScale = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainSplashScaleKey, m_TimeOfDay); m_SplashScaleVarience = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainSplashScaleVarienceKey, m_TimeOfDay); m_SplashItensity = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainSplashIntensityKey, m_TimeOfDay); m_SplashSurfaceOffset = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainSplashSurfaceOffsetKey, m_TimeOfDay); m_SplashScale *= m_Style.scaleMultiplier; m_SplashItensity *= m_Style.intensityMultiplier; m_SpriteSheetLayout.columns = m_Style.columns; m_SpriteSheetLayout.rows = m_Style.rows; m_SpriteSheetLayout.frameCount = m_Style.totalFrames; m_SpriteSheetLayout.frameRate = m_Style.animateSpeed; m_SpriteTexture = m_Style.spriteSheetTexture; m_TintColor = m_Style.tintColor * m_SkyProfile.GetColorPropertyValue(ProfilePropertyKeys.RainSplashTintColorKey, m_TimeOfDay); modelMesh = m_Style.mesh; renderMaterial = new Material(m_Style.material); }
public void UpdateForTimeOfDay(SkyProfile skyProfile, float timeOfDay) { m_SkyProfile = skyProfile; m_TimeOfDay = timeOfDay; if (!skyProfile) { return; } // Update the volume. if (m_RainAudioSource == null) { m_RainAudioSource = GetComponent <AudioSource>(); } // Suppress rain sounds if rain isn't enabled. if (skyProfile == null || m_SkyProfile.IsFeatureEnabled(ProfileFeatureKeys.RainFeature) == false) { if (m_RainAudioSource != null) { m_RainAudioSource.enabled = false; } return; } if (!rainMaterial) { Debug.LogError("Can't render rain without a rain material"); return; } if (!rainMeshRenderer) { Debug.LogError("Can't show rain without an enclosure mesh renderer."); return; } if (m_PropertyBlock == null) { m_PropertyBlock = new MaterialPropertyBlock(); } rainMeshRenderer.enabled = true; rainMeshRenderer.material = rainMaterial; rainMeshRenderer.GetPropertyBlock(m_PropertyBlock); float rainNearIntensity = skyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainNearIntensityKey, timeOfDay); float rainFarIntensity = skyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainFarIntensityKey, timeOfDay); Texture rainNearTexture = skyProfile.GetTexturePropertyValue(ProfilePropertyKeys.RainNearTextureKey, timeOfDay); Texture rainFarTexture = skyProfile.GetTexturePropertyValue(ProfilePropertyKeys.RainFarTextureKey, timeOfDay); float rainNearSpeed = skyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainNearSpeedKey, timeOfDay); float rainFarSpeed = skyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainFarSpeedKey, timeOfDay); Color tintColor = m_SkyProfile.GetColorPropertyValue(ProfilePropertyKeys.RainTintColorKey, m_TimeOfDay); float turbulence = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainWindTurbulence, m_TimeOfDay); float turbulenceSpeed = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainWindTurbulenceSpeed, m_TimeOfDay); float nearTiling = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainNearTextureTiling, m_TimeOfDay); float farTiling = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainFarTextureTiling, m_TimeOfDay); if (rainNearTexture != null) { m_PropertyBlock.SetTexture("_NearTex", rainNearTexture); m_PropertyBlock.SetVector("_NearTex_ST", new Vector4(nearTiling, nearTiling, nearTiling, 1)); } m_PropertyBlock.SetFloat("_NearDensity", rainNearIntensity); m_PropertyBlock.SetFloat("_NearRainSpeed", rainNearSpeed); if (rainFarTexture != null) { m_PropertyBlock.SetTexture("_FarTex", rainFarTexture); m_PropertyBlock.SetVector("_FarTex_ST", new Vector4(farTiling, farTiling, farTiling, 1)); } m_PropertyBlock.SetFloat("_FarDensity", rainFarIntensity); m_PropertyBlock.SetFloat("_FarRainSpeed", rainFarSpeed); m_PropertyBlock.SetColor("_TintColor", tintColor); m_PropertyBlock.SetFloat("_Turbulence", turbulence); m_PropertyBlock.SetFloat("_TurbulenceSpeed", turbulenceSpeed); rainMeshRenderer.SetPropertyBlock(m_PropertyBlock); if (skyProfile.IsFeatureEnabled(ProfileFeatureKeys.RainSoundFeature)) { m_RainAudioSource.enabled = true; m_RainAudioSource.volume = skyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainSoundVolumeKey, timeOfDay); } else { m_RainAudioSource.enabled = false; } }