private void OnEnable() { if (screenTransitionManager == null) { screenTransitionManager = this; } else if (screenTransitionManager != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); ResetMaterial(fadeTransitionMaterial); ResetMaterial(triangleTransitionMaterial); ResetMaterial(horizontalDistortionTransitionMaterial); ResetMaterial(sawtoothTransitionMaterial); ResetMaterial(angularTransitionMaterial); implemented[(int)Transition.Fade] = true; implemented[(int)Transition.Triangle] = true; implemented[(int)Transition.HorizontalDistortion] = true; implemented[(int)Transition.Sawtooth] = true; implemented[(int)Transition.Angular] = true; if (debugTextbox != null) { debugText = debugTextbox.GetComponent <Text>(); } }
private void Awake() { if (mInstance != null) { Destroy(gameObject); return; } UnityEngine.SceneManagement.SceneManager.activeSceneChanged += OnActiveSceneChanged; mInstance = this; DontDestroyOnLoad(gameObject); mPlayerStats = GetComponentInChildren <CharacterStatistics>(); mSaveManager = GetComponent <SaveManager>(); mTransitionManager = GetComponentInChildren <ScreenTransitionManager>(); mCinematicDirector = GetComponentInChildren <CinematicDirector>(); mCinematicDataProvider = GetComponentInChildren <CinematicDataProvider>(); mCharacterStatInfo = GetComponentInChildren <CharacterStatInfo>(); mCentralEvents = new CentralEvents(); mCompanionBuilder = GetComponentInChildren <CompanionBuilder>(); mEnemyDirector = GetComponentInChildren <EnemyDirector>(); mSoundManager = GetComponentInChildren <SoundManager>(); mQuirkRegistry = GetComponentInChildren <QuirkRegistry>(); mSaveManager.LoadGame(); playerData.onPlayerDataChanged += OnPlayerDataChanged; playerStats.onCharacterStatisticsChanged += OnPlayerStatsChanged; }
public void Initialize(ScreenTransitionStore screenTransitionStore) { if (_instance) { return; } _instance = this; _canvas.sortingOrder = _canvasSortOrder; // Instantiate all screen transition with don't destroy on load foreach (var prefab in screenTransitionStore.ScreenTransitionPrefabs) { ScreenTransition screenTransitionInstance = Instantiate(prefab, _canvas.transform); screenTransitionInstance.gameObject.SetActive(false); _screenTransitionInstances.Add(screenTransitionInstance.Name, screenTransitionInstance); } if (_screenTransitionInstances.Count > 0) { _currentTransition = _screenTransitionInstances.First().Value; } else { Debug.LogWarning("No screen transition found!"); } DontDestroyOnLoad(_instance); }
public void GoToScreen(EScreen screenType, bool showTransition = true) { if (showTransition) { ScreenTransitionManager.ShowTransition(); StartCoroutine(LoadScene(screenType)); } else { SceneManager.LoadScene(ScreenTypeToString(screenType)); } if (CurrentScreen != EScreen.None) { _previousScenes.Push(CurrentScreen); } CurrentScreen = screenType; }