Skip to content

Commit

Permalink
Part index updates tallies as part of coroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
rudderbucky committed Jun 18, 2023
1 parent 9bea4cd commit 1684a01
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Assets/Scripts/PartIndexScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
Expand Down

0 comments on commit 1684a01

Please sign in to comment.