public void incrementScoreStream(CollectibleFrame frame) { if (scoreStream.Count > BUFFERSIZE - 1) { scoreStream.RemoveFirst(); } scoreStream.AddLast(frame); }
public Vector3 calcNextSpawnLocation() { scoreStreamScore = 0; int scoreStreamPossible = 0; CollectibleFrame[] sphereFrames = new CollectibleFrame[BUFFERSIZE]; int xRegion; // 0-7 int yRegion; // 0-7 int score; // 5-125 List <int> xRegionChange = new List <int>(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); if (Index > 5) { scoreStream.CopyTo(sphereFrames, 0); for (int i = 0; i < scoreStream.Count; i++) { scoreStreamPossible += sphereFrames[i].Score; scoreStreamScore += sphereFrames[i].TOTAL; } float scoreStreamPercent = scoreStreamScore / scoreStreamPossible; //////////////////////////////// //HERES WHERE THINGS GET WEIRD// //////////////////////////////// if (scoreStreamPercent < .2) { xRegionChange = new List <int>(new int[] { -5, -4, -3, -2, -1, 0, 5, 10 }); } else if (scoreStreamPercent < .3) { xRegionChange = new List <int>(new int[] { -2, -2, -2, -2, 0, 5, 5, 5 }); } else if (scoreStreamPercent < .5) { xRegionChange = new List <int>(new int[] { 0, 0, 0, 1, 5, 3, -1, -2 }); } else if (scoreStreamPercent < .7) { xRegionChange = new List <int>(new int[] { 0, 1, 2, 5, 4, -1, -2, -5 }); } else if (scoreStreamPercent < .8) { xRegionChange = new List <int>(new int[] { 1, 2, 4, 6, 8, -2, -4, -8 }); } else //if score => .8 { xRegionChange = new List <int>(new int[] { 3, 4, 5, 5, 0, -5, -5, -5 }); } } regionChanger(xRegionChange); //modifies xRegionWeight xRegion = regionPicker(xRegionWeight); //anywhere from 5-7 yRegion = Random.Range(0, 8); //anywhere from 0-7 //Debug.Log ("SpawnTime" + defaultSpawnTime); score = calculateScore(xRegion); Vector3 spawnLocation = new Vector3( xRegion, yRegion, score); return(spawnLocation); }