public void OnLevelWasLoaded(int level) { if (_partManager != null) { _partManager.Unload(); _partManager = null; } }
public void OnLevelWasInitialized(int level) { var sceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name; if (sceneName == "CustomScene") { var customMainMenu = GameObject.Find("CustomMainMenu"); _partManager = customMainMenu.AddComponent <PartManager>(); } }
public void OnUpdate() { try { if (_partManager != null) { var currentBoneModFile = PartManager.GetCurrentlyEditedBoneModFilePath(); if (currentBoneModFile == null && _partManager.HasGUI) { // Character changed to one w/o bone mod _partManager.Unload(); _editedBoneModeFilePath = null; } if (currentBoneModFile != null && currentBoneModFile != _editedBoneModeFilePath) { // Loaded BoneModFile changed changed _partManager.Unload(); } if (currentBoneModFile != null) { if (!_partManager.HasGUI && PartManager.CanCreateGUI()) { if (PartManager.EditableFileExists()) { _partManager.Load(); _editedBoneModeFilePath = currentBoneModFile; } } } } if (Input.GetKeyDown(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.M)) { if (_partManager != null) { _partManager.MirrorEdit = !_partManager.MirrorEdit; } } } catch (Exception e) { _log.Error($"Exception of type {e.GetType()} thrown: {e}"); throw; } }