private void OnPlanetColorGradientDataLoaded(object asset, object cookie) { this.planetColorGradientDataLoaded = true; GameObject gameObject = asset as GameObject; this.lightingData = gameObject.GetComponent <PlanetaryLightingMonoBehaviour>(); if (this.lightingData == null) { Service.Logger.Error("Failed find lighting data; asset name: " + gameObject.name); } else if (this.IsTimePausedInDayPhase()) { this.SetTimeOfDayColorToTheDayPhase(); } }
private void LoadPlanetLightingData(string assetName) { AssetManager assetManager = Service.AssetManager; if (this.planetColorHandle != AssetHandle.Invalid) { assetManager.Unload(this.planetColorHandle); this.planetColorHandle = AssetHandle.Invalid; if (this.lightingData != null && this.lightingData.gameObject != null) { UnityEngine.Object.DestroyImmediate(this.lightingData.gameObject); } this.lightingData = null; } this.planetColorGradientDataLoaded = false; assetManager.Load(ref this.planetColorHandle, assetName, new AssetSuccessDelegate(this.OnPlanetColorGradientDataLoaded), new AssetFailureDelegate(this.OnPlanetColorFailedToLoad), null); }