private void OnMapExited() { if (_body != FlightGlobals.currentMainBody) { OnDemandStorage.DisableBodyCBMaps(_body.transform.name); } }
// Load the Map public void Load() { // Check if the Map is already loaded if (IsLoaded) { return; } // Load the Map Texture2D map = OnDemandStorage.LoadTexture(Path, false, false, false); // If the map isn't null if (map != null) { CreateMap(Depth, map); timer = new Timer(60000d); timer.Elapsed += delegate(object sender, ElapsedEventArgs e) { Unload(); }; timer.Start(); IsLoaded = true; Debug.Log("[OD] Map " + name + " enabling self. Path = " + Path); return; } // Return nothing Debug.Log("[OD] ERROR: Failed to load map " + name + " at path " + Path); }
private void OnVesselLoad(Vessel vessel) { if (vessel.mainBody == _body) { OnDemandStorage.EnableBodyCBMaps(_body.transform.name); } else { OnDemandStorage.DisableBodyCBMaps(_body.transform.name); } }
private void OnGameSceneLoadRequested(GameScenes scene) { if (scene == GameScenes.TRACKSTATION) { OnDemandStorage.EnableBodyCBMaps(_body.transform.name); } else { OnDemandStorage.DisableBodyCBMaps(_body.transform.name); } }
private void OnVesselSOIChanged(GameEvents.HostedFromToAction <Vessel, CelestialBody> action) { if ([email protected] == _body.transform.name) { OnDemandStorage.DisableBodyCBMaps(_body.transform.name); } if ([email protected] == _body.transform.name) { OnDemandStorage.EnableBodyCBMaps(_body.transform.name); } }
// Disabling public override void OnSphereInactive() { // Don't update, if the Injector is still running if (!isLoaded) { return; } // Enable the maps if (OnDemandStorage.DisableBody(sphere.name)) { isLoaded = false; Debug.Log("[OD] Disabling Body " + base.sphere.name + ": " + isLoaded); } }
// Enabling public override void OnQuadPreBuild(PQ quad) { // Don't update, if the Injector is still running if (isLoaded) { return; } // Enable the maps if (OnDemandStorage.EnableBody(sphere.name)) { isLoaded = true; Debug.Log("[OD] Enabling Body " + base.sphere.name + ": " + isLoaded); } }
void UnloadTextures() { Debug.Log("[OD] <--- ScaledSpaceDemand.UnloadTextures destroying " + texture + " and " + normals); // Kill Diffuse if (OnDemandStorage.TextureExists(texture)) { DestroyImmediate(scaledRenderer.material.GetTexture("_MainTex")); } // Kill Normals if (OnDemandStorage.TextureExists(normals)) { DestroyImmediate(scaledRenderer.material.GetTexture("_BumpMap")); } // Flags isLoaded = false; }
void LoadTextures() { Debug.Log("[OD] --> ScaledSpaceDemand.LoadTextures loading " + texture + " and " + normals); // Load Diffuse if (OnDemandStorage.TextureExists(texture)) { scaledRenderer.material.SetTexture("_MainTex", OnDemandStorage.LoadTexture(texture, false, true, true)); } // Load Normals if (OnDemandStorage.TextureExists(normals)) { scaledRenderer.material.SetTexture("_BumpMap", OnDemandStorage.LoadTexture(normals, false, true, false)); } // Flags isLoaded = true; }
// Enabling public override void OnQuadPreBuild(PQ quad) { // It is supposed to be loaded now so clear the unload time unloadTime = 0; // Don't update, if the Injector is still running if (isLoaded) { return; } // Enable the maps if (OnDemandStorage.EnableBodyPQS(sphere.name)) { isLoaded = true; Debug.Log("[OD] Enabling Body " + base.sphere.name + ": " + isLoaded); } }
void LateUpdate() { // If we aren't loaded or we're not wanting to unload then do nothing if (!isLoaded || unloadTime == 0) { return; } // If we're past the unload time then unload if (System.Diagnostics.Stopwatch.GetTimestamp() > unloadTime) { // Disable the maps if (OnDemandStorage.DisableBody(sphere.name)) { Debug.Log("[OD] Disabling Body " + base.sphere.name + ": " + isLoaded); } isLoaded = false; } }
public void UnloadTextures() { Debug.Log("[OD] <--- ScaledSpaceDemand.UnloadTextures destroying " + texture + " and " + normals); // Kill Diffuse if (OnDemandStorage.TextureExists(texture)) { DestroyImmediate(scaledRenderer.sharedMaterial.GetTexture(MainTex)); } // Kill Normals if (OnDemandStorage.TextureExists(normals)) { DestroyImmediate(scaledRenderer.sharedMaterial.GetTexture(BumpMap)); } // Events Events.OnScaledSpaceUnload.Fire(this); // Flags isLoaded = false; }
// Load the Map public void Load() { // Check if the Map is already loaded if (IsLoaded) { return; } // Load the Map Texture2D map = OnDemandStorage.LoadTexture(Path, false, false, false); // If the map isn't null if (map != null) { CreateMap(Depth, map); IsLoaded = true; Debug.Log("[OD] ---> Map " + name + " enabling self. Path = " + Path); return; } // Return nothing Debug.Log("[OD] ERROR: Failed to load map " + name + " at path " + Path); }
// OnBecameInvisible(), kill the texture void OnBecameInvisible() { // If it is already loaded, return if (!isLoaded) { return; } // Kill Diffuse if (OnDemandStorage.TextureExists(texture)) { DestroyImmediate(scaledRenderer.material.GetTexture("_MainTex")); } // Kill Normals if (OnDemandStorage.TextureExists(normals)) { DestroyImmediate(scaledRenderer.material.GetTexture("_BumpMap")); } // Flags isLoaded = false; }
// OnBecameVisible(), load the texture void OnBecameVisible() { // If it is already loaded, return if (isLoaded) { return; } // Load Diffuse if (OnDemandStorage.TextureExists(texture)) { scaledRenderer.material.SetTexture("_MainTex", OnDemandStorage.LoadTexture(texture, false, true, true)); } // Load Normals if (OnDemandStorage.TextureExists(normals)) { scaledRenderer.material.SetTexture("_BumpMap", OnDemandStorage.LoadTexture(normals, false, true, false)); } // Flags isLoaded = true; }
public void LoadTextures() { Debug.Log("[OD] --> ScaledSpaceDemand.LoadTextures loading " + texture + " and " + normals); // Load Diffuse if (OnDemandStorage.TextureExists(texture)) { scaledRenderer.sharedMaterial.SetTexture(MainTex, OnDemandStorage.LoadTexture(texture, false, true, true)); } // Load Normals if (OnDemandStorage.TextureExists(normals)) { scaledRenderer.sharedMaterial.SetTexture(BumpMap, OnDemandStorage.LoadTexture(normals, false, true, false)); } // Events Events.OnScaledSpaceLoad.Fire(this); // Flags isLoaded = true; }
private void OnMapEntered() { OnDemandStorage.EnableBodyCBMaps(_body.transform.name); }
private void OnGameSceneLoadRequested(GameScenes scene) { OnDemandStorage.DisableBodyCBMaps(_body.transform.name); }