public void LateUpdate() { string sceneName = SceneManager.GetActiveScene().name; if (this.sceneChanged) { this.sceneChanged = false; if (sceneName == "Gameplay") { gameManager = new GameManagerWrapper(GameObject.Find("Game Manager")?.GetComponent <GameManager>()); if (!gameManager.IsNull()) { soloCounter = gameManager.BasePlayers[0].SoloCounter; scoreManager = gameManager.ScoreManager; } lastCombo = 0; } } if (sceneName == "Gameplay" && !gameManager.IsNull()) { int currentCombo = scoreManager.OverallCombo; if (currentCombo > 0 && currentCombo != lastCombo && (currentCombo == 50 || currentCombo % 100 /*100*/ == 0)) { var textElement = new GameObject(string.Empty, new Type[] { typeof(DancingText) }); textElement.GetComponent <DancingText>().GameManager = gameManager; textElement.GetComponent <DancingText>().Text = $"{currentCombo} Note Streak!"; textElement.GetComponent <DancingText>().Font = uiFont; textElement.GetComponent <DancingText>().RaisedForSolo = true; // Could be soloCounter.Bool2 but I want to gauge how people respond first. } lastCombo = currentCombo; } else if (sceneName == "Main Menu") { if (uiFont is null) { //TODO: Get the font directly from the bundle? uiFont = GameObject.Find("Profile Title").GetComponent <Text>().font; } if (!versionCheck.HasVersionBeenChecked) { if (config.SilenceUpdates) { versionCheck.HasVersionBeenChecked = true; } else { string detectedVersion = GlobalVariablesWrapper.instance.buildVersion; versionCheck.CheckVersion(detectedVersion); } } } }
public void LateUpdate() { string sceneName = SceneManager.GetActiveScene().name; if (this.sceneChanged) { this.sceneChanged = false; if (sceneName == "Gameplay") { gameManager = GameManagerWrapper.Wrap(GameObject.Find("Game Manager")?.GetComponent <GameManager>()); if (!gameManager.IsNull()) { soloCounter = gameManager.BasePlayers[0].SoloCounter; scoreManager = gameManager.ScoreManager; } lastCombo = 0; detectedHotStart = false; numPlayers = 0; for (int i = 0; i < 4; ++i) { numPlayers += gameManager.BasePlayers[i].IsNull() ? 0 : 1; starPowers[i] = 0.0f; } } } if (sceneName == "Gameplay" && !gameManager.IsNull()) { int currentCombo = scoreManager.OverallCombo; if (config.NoteStreakEnabled && currentCombo > 0 && currentCombo != lastCombo && (currentCombo == 50 || currentCombo % 100 == 0)) { CreateDancingText($"{currentCombo} Note Streak!"); } if (!detectedHotStart && currentCombo == 25) { if (config.HotStartEnabled) { bool allPlayersFC = true; foreach (var player in gameManager.BasePlayers) { allPlayersFC &= player.IsNull() || !player.FirstNoteMissed; } if (allPlayersFC) { CreateDancingText($"Hot Start!"); } } detectedHotStart = true; } if (config.StarPowerActiveEnabled) { for (int i = 0; i < 4; ++i) { var player = gameManager.BasePlayers[i]; if (!player.IsNull()) { if (starPowers[i] < 0.5f && player.SPAmount >= 0.5f) { CreateDancingText(numPlayers > 1 ? $"{player.Player.PlayerProfile.PlayerName} Star Power Active!" : "Star Power Active!"); } starPowers[i] = player.SPAmount; } } } lastCombo = currentCombo; } else if (sceneName == "Main Menu") { if (uiFont is null) { //TODO: Get the font directly from the bundle? uiFont = GameObject.Find("Profile Title").GetComponent <Text>().font; } } config.HandleInput(); }