public void LateUpdate() { if (sceneChanged) { sceneChanged = false; if (isGameplay) { var gameManager = GameManagerWrapper.Wrap(GameObject.Find("Game Manager").GetComponent <GameManager>()); if (!(isBot = gameManager.BasePlayers[0].Player.PlayerProfile.Bot.GetBoolValue)) { var challengeFactory = new ChallengeFactory(); activeChallenge = challengeFactory.CreateChallenge(gameManager); Logger.LogDebug(activeChallenge.ChallengeGoal); healthContainer = gameManager.BasePlayers[0].HealthContainer; healthContainer.CastToMonoBehaviour().gameObject.SetActive(true); Logger.LogDebug("Updated!"); var clonedSPBar = Instantiate(GameObject.Find("SPBar")); clonedSPBar.transform.localPosition = new Vector3(0.016f, 0.0f, 5.0f); clonedSPBar.transform.localScale = new Vector3(-1.0f, 1.0f, 1.0f); clonedSPBar.transform.GetChild(0).GetComponent <SpriteRenderer>().enabled = false; Destroy(clonedSPBar.transform.GetChild(4).gameObject); clonedSPBar.transform.GetChild(6).GetComponent <SpriteRenderer>().color = new Color(1.0f, 0.5f, 0.6f); clonedSPBar.transform.GetChild(7).GetComponent <SpriteRenderer>().color = new Color(1.0f, 0.5f, 0.6f); spBar = SPBarWrapper.Wrap(clonedSPBar.GetComponent <SPBar>()); challengeBar = ChallengeBar.InstantiatePrefab(GameObject.Find("SPBar").transform.parent); } } else { activeChallenge = null; } } if (isGameplay && hasSetupChallenge && !isBot) { activeChallenge.Update(); //Logger.LogDebug($"Just before I run SetState, I have value {Mathf.Clamp(activeChallenge.PercentageToGold, 0.00001f, 1.0f)}, last {healthContainer.LastHealth}, RYT {healthContainer.RedYellowThreshold}, YGT {healthContainer.YellowGreenThreshold}"); challengeBar.SetState(activeChallenge); healthContainer.SetState(activeChallenge.PercentageToGold); spBar.SetFill(activeChallenge.PercentageToBronze, false); } }
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(); }
public void LateUpdate() { if (uiFont is null && SceneManager.GetActiveScene().name.Equals("Main Menu")) { uiFont = GameObject.Find("Profile Title").GetComponent <Text>().font; } if (sceneChanged) { sceneChanged = false; if (SceneManager.GetActiveScene().name.Equals("Gameplay")) { var gameManagerObject = GameObject.Find("Game Manager"); gameManager = GameManagerWrapper.Wrap(GameObject.Find("Game Manager")?.GetComponent <GameManager>()); if (gameManager.GlobalVariables.SongEntry.SongEntry.lyrics && gameManager.GlobalVariables.SongEntry.SongEntry.chartPath.EndsWith("notes.mid")) { string file = gameManager.GlobalVariables.SongEntry.SongEntry.chartPath; MidiParser parser = new MidiParser(file); List <List <ChartCommand> > coms = parser.ParseMidi(); commands0 = coms[0]; commands1 = coms[1]; commands2 = coms[2]; Logger.LogDebug(commands2.Count); foreach (ChartCommand com in commands2) { Logger.LogDebug($"{com.TimeInMs} {com.Command} {com.Parameter}"); } index0 = 0; index1 = 0; index2 = 0; //Logger.LogDebug(gameManager.GlobalVariables.SongEntry.SongEntry.chartPath); lyricsTransform = GameObject.Find("Lyrics").transform; altLyrics0 = CreateTmpText(lyricsTransform, "AltLyrics1", 3); altLyrics1 = CreateTmpText(lyricsTransform, "AltLyrics2", 2); altLyrics2 = CreateTmpText(lyricsTransform, "AltLyrics3", 1); altLyrics0.fontSize = 44f; altLyrics1.fontSize = 44f; altLyrics2.fontSize = 44f; altLyrics0.transform.localPosition = new Vector2(0, 460); altLyrics1.transform.localPosition = new Vector2(0, 300); altLyrics2.transform.localPosition = new Vector2(0, 240); altLyrics0.horizontalAlignment = HorizontalAlignmentOptions.Center; altLyrics1.horizontalAlignment = HorizontalAlignmentOptions.Center; altLyrics2.horizontalAlignment = HorizontalAlignmentOptions.Center; altLyrics0.gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.width / 2, altLyrics0.preferredHeight); altLyrics1.gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.width / 2, altLyrics1.preferredHeight); altLyrics2.gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.width / 2, altLyrics2.preferredHeight); indexes0 = new List <int>(); indexes1 = new List <int>(); indexes2 = new List <int>(); ClearLyric0(); ClearLyric1(); ClearLyric2(); } else if (gameManager.GlobalVariables.SongEntry.SongEntry.lyrics && gameManager.GlobalVariables.SongEntry.SongEntry.chartPath.EndsWith("notes.chart")) { string file = gameManager.GlobalVariables.SongEntry.SongEntry.chartPath; LyricsParser parser = new LyricsParser(file); commands0 = parser.ParseLyrics()[0]; index0 = 0; Logger.LogDebug(gameManager.GlobalVariables.SongEntry.SongEntry.chartPath); lyricsTransform = GameObject.Find("Lyrics").transform; altLyrics0 = CreateTmpText(lyricsTransform, "AltLyrics1", 1); altLyrics0.fontSize = 44f; altLyrics0.transform.localPosition = new Vector2(0, 460); altLyrics0.horizontalAlignment = HorizontalAlignmentOptions.Center; altLyrics0.gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.width / 2, altLyrics0.preferredHeight); indexes0 = new List <int>(); ClearLyric0(); ClearLyric1(); ClearLyric2(); } else { commands0 = new List <ChartCommand>(); } //UpdateTextButton(altLyrics, "TEST", 40, Color.white); } } if (SceneManager.GetActiveScene().name.Equals("Gameplay")) { if (index0 < commands0.Count) { if (TimeSpan.FromSeconds(gameManager.SongTime).TotalMilliseconds >= commands0[index0].TimeInMs) { ChartCommand curCommand = commands0[index0++]; if (curCommand.Command == "phrase_start") { ClearLyric0(); int i = 0; ChartCommand x; while ((index0 + i) < commands0.Count && (x = commands0[index0 + i++]).Command == "lyric") { altLyricText0 += x.Parameter; if (altLyricText0.EndsWith("=")) { altLyricText0 = altLyricText0.TrimEnd('=') + "-"; } else if (altLyricText0.EndsWith("$") || altLyricText0.EndsWith("#")) { altLyricText0 = altLyricText0.TrimEnd(new char[] { '$', '#' }); } else if (altLyricText0.EndsWith("-")) { altLyricText0 = altLyricText0.TrimEnd('-'); } else { altLyricText0 += " "; } indexes0.Add(altLyricText0.Length); } altLyrics0.text = altLyricText0; } else if (curCommand.Command == "phrase_end") { ClearLyric0(); } else { altLyrics0.text = "<color=#47a9ea>" + altLyricText0.Substring(0, indexes0[colorIndex0]) + "</color>" + altLyricText0.Substring(indexes0[colorIndex0++]); } //altLyrics.text = $"{curCommand.Command} {curCommand.Parameter}"; } } if (index1 < commands1.Count) { if (TimeSpan.FromSeconds(gameManager.SongTime).TotalMilliseconds >= commands1[index1].TimeInMs) { ChartCommand curCommand = commands1[index1++]; if (curCommand.Command == "phrase_start") { ClearLyric1(); int i = 0; ChartCommand x; while ((index1 + i) < commands1.Count && (x = commands1[index1 + i++]).Command == "lyric") { altLyricText1 += x.Parameter; if (altLyricText1.EndsWith("=")) { altLyricText1 = altLyricText1.TrimEnd('=') + "-"; } else if (altLyricText1.EndsWith("$") || altLyricText1.EndsWith("#")) { altLyricText1 = altLyricText1.TrimEnd(new char[] { '$', '#' }); } else if (altLyricText1.EndsWith("-")) { altLyricText1 = altLyricText1.TrimEnd('-'); } else { altLyricText1 += " "; } indexes1.Add(altLyricText1.Length); } altLyrics1.text = altLyricText1; } else if (curCommand.Command == "phrase_end") { ClearLyric1(); } else { altLyrics1.text = "<color=#e59b2b>" + altLyricText1.Substring(0, indexes1[colorIndex1]) + "</color>" + altLyricText1.Substring(indexes1[colorIndex1++]); } //altLyrics.text = $"{curCommand.Command} {curCommand.Parameter}"; } } if (index2 < commands2.Count) { if (TimeSpan.FromSeconds(gameManager.SongTime).TotalMilliseconds >= commands2[index2].TimeInMs) { Logger.LogDebug("TEST0"); ChartCommand curCommand = commands2[index2++]; Logger.LogDebug("TEST1"); if (curCommand.Command == "phrase_start") { ClearLyric2(); int i = 0; ChartCommand x; while ((index2 + i) < commands2.Count && (x = commands2[index2 + i++]).Command == "lyric") { Logger.LogDebug("TEST2"); altLyricText2 += x.Parameter; if (altLyricText2.EndsWith("=")) { altLyricText2 = altLyricText2.TrimEnd('=') + "-"; } else if (altLyricText2.EndsWith("$") || altLyricText2.EndsWith("#")) { altLyricText2 = altLyricText2.TrimEnd(new char[] { '$', '#' }); } else if (altLyricText2.EndsWith("-")) { altLyricText2 = altLyricText2.TrimEnd('-'); } else { altLyricText2 += " "; } indexes2.Add(altLyricText2.Length); } altLyrics2.text = altLyricText2; } else if (curCommand.Command == "phrase_end") { ClearLyric2(); } else { altLyrics2.text = "<color=#af3e1c>" + altLyricText2.Substring(0, indexes2[colorIndex2]) + "</color>" + altLyricText2.Substring(indexes2[colorIndex2++]); } //altLyrics.text = $"{curCommand.Command} {curCommand.Parameter}"; } } } }
public void LateUpdate() { string sceneName = SceneManager.GetActiveScene().name; if (this.sceneChanged) { this.sceneChanged = false; if (sceneName == "Gameplay") { int uiLayerMask = LayerMask.NameToLayer("UI"); var gameManagerObject = GameObject.Find("Game Manager"); gameManager = GameManagerWrapper.Wrap(gameManagerObject.GetComponent <GameManager>()); ResetGameplaySceneValues(); DestroyAndNullGameplayLabels(); Transform canvasTransform = FadeBehaviourWrapper.Instance.FadeGraphic.canvas.transform; accuracyIndicatorLabel = new GameObject($"Accuracy Indicator", new Type[] { typeof(Text), typeof(DestroyOnSceneChange) }); accuracyIndicatorLabel.layer = uiLayerMask; accuracyIndicatorLabel.transform.SetParent(canvasTransform); accuracyIndicatorLabel.transform.SetSiblingIndex(0); accuracyIndicatorLabel.transform.localEulerAngles = new Vector3(); accuracyIndicatorLabel.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); accuracyIndicatorLabel.GetComponent <Text>().horizontalOverflow = HorizontalWrapMode.Overflow; accuracyIndicatorLabel.GetComponent <Text>().verticalOverflow = VerticalWrapMode.Overflow; accuracyIndicatorLabel.GetComponent <Text>().font = BiendeoCHLib.BiendeoCHLib.Instance.CloneHeroDefaultFont; accuracyMessageLabel = new GameObject($"Accuracy Message", new Type[] { typeof(Text), typeof(DestroyOnSceneChange) }); accuracyMessageLabel.layer = uiLayerMask; accuracyMessageLabel.transform.SetParent(canvasTransform); accuracyMessageLabel.transform.SetSiblingIndex(0); accuracyMessageLabel.transform.localEulerAngles = new Vector3(); accuracyMessageLabel.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); accuracyMessageLabel.GetComponent <Text>().horizontalOverflow = HorizontalWrapMode.Overflow; accuracyMessageLabel.GetComponent <Text>().verticalOverflow = VerticalWrapMode.Overflow; accuracyMessageLabel.GetComponent <Text>().font = BiendeoCHLib.BiendeoCHLib.Instance.CloneHeroDefaultFont; averageAccuracyLabel = new GameObject($"Average Accuracy", new Type[] { typeof(Text), typeof(DestroyOnSceneChange) }); averageAccuracyLabel.layer = uiLayerMask; averageAccuracyLabel.transform.SetParent(canvasTransform); averageAccuracyLabel.transform.SetSiblingIndex(0); averageAccuracyLabel.transform.localEulerAngles = new Vector3(); averageAccuracyLabel.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); averageAccuracyLabel.GetComponent <Text>().horizontalOverflow = HorizontalWrapMode.Overflow; averageAccuracyLabel.GetComponent <Text>().verticalOverflow = VerticalWrapMode.Overflow; averageAccuracyLabel.GetComponent <Text>().font = BiendeoCHLib.BiendeoCHLib.Instance.CloneHeroDefaultFont; } else { DestroyAndNullGameplayLabels(); } if (config.Enabled && sceneName == "EndOfSong") { InstantiateEndOfSongLabels(); } } if (sceneName == "Gameplay") { //! In practice mode, the song time is set to 1.5s before the section or A/B. If it is looping, it is //! initially set to 0, then to the appropriate time. As long as the user isn't on less than 10FPS, this should work. if (Math.Abs(gameManager.SongTime - lastSongTime) > 1.5 && gameManager.PracticeUI.PracticeUI != null) { ResetGameplaySceneValues(); } UpdateGreatestThresholds(); UpdateLabels(); } config.HandleInput(); if (!gameManager.IsNull()) { lastSongTime = gameManager.SongTime; } }
public void LateUpdate() { string sceneName = SceneManager.GetActiveScene().name; if (this.sceneChanged) { this.sceneChanged = false; if (sceneName == "Gameplay") { var gameManagerObject = GameObject.Find("Game Manager"); gameManager = GameManagerWrapper.Wrap(gameManagerObject.GetComponent <GameManager>()); starProgress = gameManager.StarProgress; basePlayers = gameManager.BasePlayers; songLength = TimeSpan.FromSeconds(gameManager.SongLength); numPlayers = basePlayers.Count(bp => !bp.IsNull()); for (int i = bandIndex; i >= 0; --i) { if (i == bandIndex) { totalNoteCount[i] = 0; totalStarPowers[i] = 0; } else { var player = basePlayers[i]; if (!player.IsNull()) { var notes = player.Notes; totalNoteCount[bandIndex] += (totalNoteCount[i] = notes.Count); totalStarPowers[bandIndex] += (totalStarPowers[i] = notes.Count(n => n.IsStarPowerEnd)); } else { totalNoteCount[i] = 0; hitNotesPercentage[i] = 100.0; seenNotesPercentage[i] = 100.0; totalStarPowers[i] = 0; } } hitNotes[i] = 0; missedNotes[i] = 0; seenNotes[i] = 0; hitNotesPercentage[i] = 0.00; seenNotesPercentage[i] = 0.00; fcIndicator[i] = "FC"; starPowersGotten[i] = 0; starPowerPercentage[i] = 0.00; currentStarPower[i] = 0.00; currentCombo[i] = 0; highestCombo[i] = 0; } DestroyLabels(); Transform canvasTransform = FadeBehaviourWrapper.Instance.FadeGraphic.canvas.transform; foreach (var label in config.Layout[numPlayers - 1]) { CreateGameplayLabel(canvasTransform, label); } } else { DestroyLabels(); } } if (sceneName == "Gameplay" && !gameManager.IsNull() && gameManager.PracticeUI.PracticeUI == null) { // Song length songTime = TimeSpan.FromSeconds(Math.Max(Math.Min(gameManager.SongTime, gameManager.SongLength), 0.0)); songTimePercentage = Math.Max(Math.Min(gameManager.SongTime * 100.0 / gameManager.SongLength, 100.0), 0.0); // Star progress currentStarCount = starProgress.CurrentStar; currentScore = Math.Min(starProgress.LastScore, starProgress.StarScores[6]); //TODO: Migrate to ScoreManager 'cause this stops incremented after you reach 7-star. previousStarScore = starProgress.CurrentStar == 0 ? 0 : starProgress.StarScores[starProgress.CurrentStar - 1]; nextStarScore = starProgress.StarScores[starProgress.CurrentStar]; nextStarPercentage = starProgress.CurrentStar < 7 ? (currentScore - previousStarScore) * 100.0 / (nextStarScore - previousStarScore) : 100.0; sevenStarScore = starProgress.StarScores[6]; sevenStarPercentage = Math.Min(currentScore * 100.0 / sevenStarScore, 100.0); currentStarPower[bandIndex] = 0.0; for (int i = 0; i < bandIndex; ++i) { var player = basePlayers[i]; if (!player.IsNull()) { currentStarPower[i] = player.SPBar.LastFillAmount * 100.0; currentStarPower[bandIndex] += currentStarPower[i]; } } foreach (var label in labels) { UpdateGameplayLabel(label.Item1, label.Item2, label.Item3); } } config.HandleInput(); }
public void LateUpdate() { string sceneName = SceneManager.GetActiveScene().name; if (this.sceneChanged) { this.sceneChanged = false; if (sceneName == "Gameplay") { int uiLayerMask = LayerMask.NameToLayer("UI"); var gameManagerObject = GameObject.Find("Game Manager"); gameManager = GameManagerWrapper.Wrap(gameManagerObject.GetComponent <GameManager>()); ResetGameplaySceneValues(); DestroyAndNullGameplayLabels(); Transform canvasTransform = FadeBehaviourWrapper.Instance.FadeGraphic.canvas.transform; displayImageLabel = new GameObject($"Perfect Mode Indicator", new Type[] { typeof(Text) }); displayImageLabel.layer = uiLayerMask; displayImageLabel.transform.SetParent(canvasTransform); displayImageLabel.transform.SetSiblingIndex(0); displayImageLabel.transform.localEulerAngles = new Vector3(); displayImageLabel.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); displayImageLabel.GetComponent <Text>().horizontalOverflow = HorizontalWrapMode.Overflow; displayImageLabel.GetComponent <Text>().verticalOverflow = VerticalWrapMode.Overflow; displayImageLabel.GetComponent <Text>().font = uiFont; remainingNotesLeftLabel = new GameObject($"Perfect Mode Notes Remaining", new Type[] { typeof(Text) }); remainingNotesLeftLabel.layer = uiLayerMask; remainingNotesLeftLabel.transform.SetParent(canvasTransform); remainingNotesLeftLabel.transform.SetSiblingIndex(0); remainingNotesLeftLabel.transform.localEulerAngles = new Vector3(); remainingNotesLeftLabel.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); remainingNotesLeftLabel.GetComponent <Text>().horizontalOverflow = HorizontalWrapMode.Overflow; remainingNotesLeftLabel.GetComponent <Text>().verticalOverflow = VerticalWrapMode.Overflow; remainingNotesLeftLabel.GetComponent <Text>().font = uiFont; restartIndicatorLabel = new GameObject($"Perfect Mode Restart Message", new Type[] { typeof(Text) }); restartIndicatorLabel.layer = uiLayerMask; restartIndicatorLabel.transform.SetParent(canvasTransform); restartIndicatorLabel.transform.SetSiblingIndex(0); restartIndicatorLabel.transform.localEulerAngles = new Vector3(); restartIndicatorLabel.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); restartIndicatorLabel.GetComponent <Text>().horizontalOverflow = HorizontalWrapMode.Overflow; restartIndicatorLabel.GetComponent <Text>().verticalOverflow = VerticalWrapMode.Overflow; restartIndicatorLabel.GetComponent <Text>().font = uiFont; } else { DestroyAndNullGameplayLabels(); } } if (config.Enabled && sceneName == "Gameplay" && !gameManager.IsNull()) { target = config.FC ? "FC" : (config.NotesMissed == 0 ? "100%" : $"-{config.NotesMissed}"); isStillFC = !gameManager.BasePlayers[0].FirstNoteMissed; if (!failedObjective && (config.FC && !isStillFC || config.NotesMissed < missedNotes)) { failedObjective = true; remainingTimeBeforeRestart = Math.Min(config.FailDelay, (float)(gameManager.SongLength - gameManager.SongTime)); } if (failedObjective && (gameManager.PauseMenu is null || !gameManager.PauseMenu.activeInHierarchy)) { remainingTimeBeforeRestart -= Time.deltaTime; if (remainingTimeBeforeRestart < 0.0f && !invokedSceneChange) { //TODO: Double-check that multiplayer works fine with this. StartCoroutine(FadeBehaviourWrapper.Instance.InvokeSceneChange("Gameplay")); invokedSceneChange = true; } } if (config.DisplayImage.Visible || config.LayoutTest) { displayImageLabel.transform.localPosition = new Vector3(config.DisplayImage.X - Screen.width / 2, Screen.height / 2 - config.DisplayImage.Y); var text = displayImageLabel.GetComponent <Text>(); text.enabled = true; text.fontSize = config.DisplayImage.Size; text.alignment = config.DisplayImage.Alignment; text.fontStyle = (config.DisplayImage.Bold ? FontStyle.Bold : FontStyle.Normal) | (config.DisplayImage.Italic ? FontStyle.Italic : FontStyle.Normal); text.text = $"{target} mode active"; text.color = config.DisplayImage.Color.Color; } else { displayImageLabel.GetComponent <Text>().enabled = false; } if ((config.RemainingNotesLeft.Visible && !config.FC) || config.LayoutTest) { remainingNotesLeftLabel.transform.localPosition = new Vector3(config.RemainingNotesLeft.X - Screen.width / 2, Screen.height / 2 - config.RemainingNotesLeft.Y); var text = remainingNotesLeftLabel.GetComponent <Text>(); text.enabled = true; text.fontSize = config.RemainingNotesLeft.Size; text.alignment = config.RemainingNotesLeft.Alignment; text.fontStyle = (config.RemainingNotesLeft.Bold ? FontStyle.Bold : FontStyle.Normal) | (config.RemainingNotesLeft.Italic ? FontStyle.Italic : FontStyle.Normal); text.text = config.NotesMissed - missedNotes >= 0 ? $"{config.NotesMissed - missedNotes} note{(config.NotesMissed - missedNotes == 1 ? string.Empty : "s")} can be missed" : $"Too many notes missed"; text.color = config.RemainingNotesLeft.Color.Color; } else { remainingNotesLeftLabel.GetComponent <Text>().enabled = false; } if ((config.RestartIndicator.Visible && failedObjective) || config.LayoutTest) { restartIndicatorLabel.transform.localPosition = new Vector3(config.RestartIndicator.X - Screen.width / 2, Screen.height / 2 - config.RestartIndicator.Y); var text = restartIndicatorLabel.GetComponent <Text>(); text.enabled = true; text.fontSize = config.RestartIndicator.Size; text.alignment = config.RestartIndicator.Alignment; text.fontStyle = (config.RestartIndicator.Bold ? FontStyle.Bold : FontStyle.Normal) | (config.RestartIndicator.Italic ? FontStyle.Italic : FontStyle.Normal); text.text = $"{target} failed, restarting in {(int)remainingTimeBeforeRestart + 1}"; text.color = new Color(config.RestartIndicator.Color.Color.r, config.RestartIndicator.Color.Color.g, config.RestartIndicator.Color.Color.b, config.RestartIndicator.Color.Color.a * Math.Min((config.FailDelay - remainingTimeBeforeRestart) * 2.0f, 1.0f)); } else { restartIndicatorLabel.GetComponent <Text>().enabled = false; } } else if (sceneName == "Gameplay") { displayImageLabel.GetComponent <Text>().enabled = false; remainingNotesLeftLabel.GetComponent <Text>().enabled = false; restartIndicatorLabel.GetComponent <Text>().enabled = false; } if (uiFont is null && sceneName == "Main Menu") { //TODO: Get the font directly from the bundle? uiFont = GameObject.Find("Profile Title").GetComponent <Text>().font; } config.HandleInput(); }