From 1684a016815db336be30186264f48f0b2b92a13d Mon Sep 17 00:00:00 2001 From: rudderbucky Date: Sat, 17 Jun 2023 23:16:52 -0700 Subject: [PATCH] Part index updates tallies as part of coroutine --- Assets/Scripts/PartIndexScript.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/PartIndexScript.cs b/Assets/Scripts/PartIndexScript.cs index 9476fcd19..ff4491088 100644 --- a/Assets/Scripts/PartIndexScript.cs +++ b/Assets/Scripts/PartIndexScript.cs @@ -241,15 +241,27 @@ private IEnumerator AttemptAddPartHelper() if (x >= 10) { x = 0; + UpdateTextAndTally(); yield return new WaitForEndOfFrame(); } } + UpdateTextAndTally(); + yield return null; + } + + private void UpdateTextAndTally() + { for (int i = 0; i < contents.Length; i++) { texts[i].SetActive(contents[i].childCount > 0); } + UpdateTallyGraphic(); + } + + private void UpdateTallyGraphic() + { // Update tally graphic bar if (statsNumbers[3] > 0) { @@ -269,7 +281,6 @@ private IEnumerator AttemptAddPartHelper() // Just found out about string interpolation. Damn that stuff rocks. statsTotalTally.text = $"{statsNumbers[3]}"; - yield return null; } public static void AttemptAddToPartsObtained(EntityBlueprint.PartInfo part)