Improve logic for getting all berries
This commit is contained in:
5 files changed
+16
-89
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user