void Update() { if (m_SkyProfile == null || m_SkyProfile.IsFeatureEnabled(ProfileFeatureKeys.RainSplashFeature) == false) { ClearSplashRenderers(); return; } if (m_SkyProfile.rainSplashArtSet == null || m_SkyProfile.rainSplashArtSet.rainSplashArtItems == null || m_SkyProfile.rainSplashArtSet.rainSplashArtItems.Count == 0) { ClearSplashRenderers(); return; } if (m_SkyProfile.rainSplashArtSet.rainSplashArtItems.Count != m_SplashRenderers.Count) { ClearSplashRenderers(); CreateSplashRenderers(); } // Assign a style to each renderer. for (int i = 0; i < m_SkyProfile.rainSplashArtSet.rainSplashArtItems.Count; i++) { RainSplashArtItem style = m_SkyProfile.rainSplashArtSet.rainSplashArtItems[i]; RainSplashRenderer r = m_SplashRenderers[i]; r.UpdateForTimeOfDay(m_SkyProfile, m_TimeOfDay, style); } }
public void CreateSplashRenderers() { for (int i = 0; i < m_SkyProfile.rainSplashArtSet.rainSplashArtItems.Count; i++) { GameObject go = new GameObject("Rain Splash Renderer"); RainSplashRenderer r = go.AddComponent <RainSplashRenderer>(); r.transform.parent = this.transform; m_SplashRenderers.Add(r); } }