Improve logic for getting all berries

This commit is contained in:
Lncvrt committed 2026-03-06 10:27:16 -07:00
1 parent c9b469a5a0
commit 3f6849060f
5 files changed
+16 -89

No files matched your search

+2 -24
View File
@@ -494,16 +494,7 @@ public class CustomGamePlayer : MonoBehaviour {
if (!pausePanel.activeSelf && rb.gravityScale != 100f * canvasRect.lossyScale.y) rb.gravityScale = 100f * canvasRect.lossyScale.y;
foreach (AudioSource audio in FindObjectsByType<AudioSource>(FindObjectsSortMode.None)) audio.pitch = speedyLeft > 0f ? 1.3f : 1f;
GameObject[] allBerries = GameObject.FindGameObjectsWithTag("NormalBerry")
.Concat(GameObject.FindGameObjectsWithTag("PoisonBerry"))
.Concat(GameObject.FindGameObjectsWithTag("SlowBerry"))
.Concat(GameObject.FindGameObjectsWithTag("UltraBerry"))
.Concat(GameObject.FindGameObjectsWithTag("SpeedyBerry"))
.Concat(GameObject.FindGameObjectsWithTag("RandomBerry"))
.Concat(GameObject.FindGameObjectsWithTag("AntiBerry"))
.Concat(GameObject.FindGameObjectsWithTag("GoldenBerry"))
.Concat(GameObject.FindGameObjectsWithTag("NothingBerry"))
.ToArray();
var allBerries = Tools.GetAllBerries(berryParent.transform);
if (!pausePanel.activeSelf) foreach (GameObject berry in allBerries) {
if (berry.GetComponent<RectTransform>().anchoredPosition.y < -(canvasRect.rect.height / 2) - berry.GetComponent<RectTransform>().rect.height) {
@@ -558,20 +549,7 @@ public class CustomGamePlayer : MonoBehaviour {
antiLeft = 0f;
UpdateStats(0, 1);
GameObject[] allBerries = GameObject.FindGameObjectsWithTag("NormalBerry")
.Concat(GameObject.FindGameObjectsWithTag("PoisonBerry"))
.Concat(GameObject.FindGameObjectsWithTag("SlowBerry"))
.Concat(GameObject.FindGameObjectsWithTag("UltraBerry"))
.Concat(GameObject.FindGameObjectsWithTag("SpeedyBerry"))
.Concat(GameObject.FindGameObjectsWithTag("RandomBerry"))
.Concat(GameObject.FindGameObjectsWithTag("AntiBerry"))
.Concat(GameObject.FindGameObjectsWithTag("GoldenBerry"))
.Concat(GameObject.FindGameObjectsWithTag("NothingBerry"))
.ToArray();
foreach (GameObject berry in allBerries) {
noGravityBerries.Remove(berry.GetInstanceID());
Destroy(berry);
}
foreach (GameObject berry in Tools.GetAllBerries(berryParent.transform)) Destroy(berry);
}
void UpdateStats(BigInteger scoreAddAmount, BigInteger attemptAddAmount) {