only stars on screen evolve

This commit is contained in:
Rapandrasmus 2023-06-25 21:40:30 +02:00
parent 78c44a80cd
commit 929db0c175
2 changed files with 9 additions and 3 deletions

View file

@ -967,8 +967,8 @@ MonoBehaviour:
starRef: {fileID: -5335075775997835892, guid: 8df651ffe21e1dc4fb223e94fdc9f9cb, type: 3}
boundaryX: 23
boundaryY: 13
starCount: 100
blinkFrequency: 0.125
starCount: 96
blinkFrequency: 0.05
blinkAmount: 5
--- !u!1 &5576704226004728173
GameObject:

View file

@ -64,7 +64,13 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
for (int i = 0; i < amount; i++)
{
List<AgbStar> nonEvolvedStars = currentStars.ToList().FindAll(x => x.evoStage == collectiveEvoStage);
if (nonEvolvedStars.Count > 0)
List<AgbStar> onScreenStars = nonEvolvedStars.FindAll(x => x.transform.localPosition.x <= 17.77695f && x.transform.localPosition.x >= -17.77695f && x.transform.localPosition.y <= 10 && x.transform.localPosition.y >= -10);
if (onScreenStars.Count > 0)
{
AgbStar randomStar = onScreenStars[UnityEngine.Random.Range(0, onScreenStars.Count)];
randomStar.Evolve();
}
else if (nonEvolvedStars.Count > 0)
{
AgbStar randomStar = nonEvolvedStars[UnityEngine.Random.Range(0, nonEvolvedStars.Count)];
randomStar.Evolve();