private IEnumerator AddExperiance(GameManager.GameRound round, UnityAction action) { float testTime = Time.unscaledTime; foreach (GameManager.GameRound.BonusExperiance.ExperianceType expType in GameManager.instance.ExperianceSettings.ExperianceOrder) { if (round.ExperianceGained.ContainsKey(expType)) { PointText p = Instantiate <GameObject>(pointText, ProgressScreenRect).GetComponent <PointText>(); p.SetText(GameManager.instance.ExperianceSettings.GetExperiance(expType).Name); p.SetSpeed(DisplaySpeedScale); yield return(new WaitForSecondsRealtime(0.5f / DisplaySpeedScale)); int biggestStack = 0; foreach (KeyValuePair <Player, List <GameManager.GameRound.BonusExperiance> > keyValuePair in round.ExperianceGained[expType]) { biggestStack = Mathf.Max(biggestStack, keyValuePair.Value.Count); foreach (GameManager.GameRound.BonusExperiance exp in keyValuePair.Value) { PlayerUIs[keyValuePair.Key].expBar.AddPoints(exp, 0.5f / DisplaySpeedScale); } } yield return(new WaitForSecondsRealtime(0.5f / DisplaySpeedScale)); //Debug.Log(testTime - Time.unscaledTime); } } StartCoroutine(ChangeAlpha(SkipProgressText, -1, 0.25f)); StartCoroutine(ChangeAlpha(ContinueText, 1, 0.5f)); // Setup the closing the progress screen by pressing start StartCoroutine(InvokeOnPressStart(round.players, delegate { PressStart(action); })); }
/// <summary> /// Displays the progress screen overlay, and pauses game. /// </summary> /// <param name="round"> Gameround the progress screen is to display </param> /// <param name="action"> Event thats invoked when the progress screen is closed. </param> public void StartProgressScreen(GameManager.GameRound round, UnityAction action = null) { players = round.players; // Save list of players if (PlayerUIs == null) { SetUpProgressScreen(); } DisplayScreen(1f); StartCoroutine(SlowPause(2, 0.05f)); // Set up progress screen if it hasnt yet been setup // players should only be able to reach rank 10 once per game before being forced to head back to main menu. //RunEndgameChecksAndSetup(); SkipProgressText.alpha = 0; ContinueText.alpha = 0; foreach (PointText p in ProgressScreenRect.GetComponentsInChildren <PointText>()) { Destroy(p?.gameObject); } DisplaySpeedScale = 1; InvokeUnscaled(delegate { StartCoroutine(AddExperiance(round, action)); }, 1.5f); InvokeUnscaled(delegate { StartCoroutine(ChangeAlpha(SkipProgressText, 1, 0.25f)); StartCoroutine(InvokeOnPressStart(round.players, delegate { SpeedUpProgressScreen(); })); }, 1f); //// Setup the closing the progress screen by pressing start //StartCoroutine(InvokeOnPressStart(round.players, delegate{ PressStart(action); })); }