// Activates the Simulation. Returns the success of the activation. public static bool Activate() { // for recording save status, not sure what this string actually is tbh string save = null; // Make sure the instance actually exists. I can't imagine this ever failing, but NREs are bad. if (instance != null) { // We create the pre-sim save. save = GamePersistence.SaveGame("HoloDeckRevert", HighLogic.SaveFolder, SaveMode.OVERWRITE); // Mark the existing save as dirty. HoloDeck.instance.SimulationActive = true; // Record the scene we are coming from HoloDeckShelter.lastScene = HighLogic.LoadedScene; if (HoloDeckShelter.lastScene == GameScenes.EDITOR) { HoloDeck.OnLeavingEditor(EditorDriver.editorFacility, EditorLogic.fetch.launchSiteName); } // Start the tell-tale HoloDeck.instance.SimulationNotification(true); } return(save != null ? true : false); }
// This is our entry point void Start() { // update the singleton instance = this; // Reload to pre-sim if we are in the wrong scene. if (HighLogic.LoadedScene != GameScenes.FLIGHT) { HoloDeck.Deactivate(GameScenes.SPACECENTER); } // Deploy scene-specific modules, for GUI hijacking and similar logic switch (HighLogic.LoadedScene) { case GameScenes.FLIGHT: gameObject.AddComponent <FlightModule>(); break; case GameScenes.EDITOR: gameObject.AddComponent <EditorModule>(); break; } // If the sim is active, display the tell-tale SimulationNotification(SimulationActive); }
// This is our entry point void Start() { // update the singleton instance = this; // Reload to pre-sim if we are in the wrong scene. if (HighLogic.LoadedScene != GameScenes.FLIGHT) { HoloDeck.Deactivate(GameScenes.SPACECENTER); } // Deploy scene-specific modules, for GUI hijacking and similar logic switch (HighLogic.LoadedScene) { case GameScenes.FLIGHT: gameObject.AddComponent<FlightModule>(); break; case GameScenes.EDITOR: gameObject.AddComponent<EditorModule>(); break; } // If the sim is active, display the tell-tale SimulationNotification(SimulationActive); }
// This is called when the script is destroyed. // This is honestly probably not necessary, but better safe than sorry void Destroy() { SimulationNotification(false); instance = null; }