/// <summary> /// Generates TestTrials and gives them a temporary angle. /// 90 degrees are added here as we want the targets to start spawning /// straight up from the center of the screen at a distance of TargetAmplitude. /// </summary> /// <param name="amountOfTargets"></param> /// <returns></returns> private List <TestTrial> GenerateTestSteps(int amountOfTargets) { float deltaAngle = 360f / amountOfTargets; List <TestTrial> steps = new List <TestTrial>(); for (int i = 0; i < amountOfTargets; i++) { float angle = i * deltaAngle; steps.Add(new TestTrial(angle)); } TestTrial[] sortedSteps = new TestTrial[amountOfTargets]; //Even int firstHalfCounter = 0; int secondHalfCounter = 0; bool isFirstHalf = true; for (int i = 0; i < amountOfTargets; i++) { if (isFirstHalf) { sortedSteps[i] = steps[firstHalfCounter]; firstHalfCounter++; } else { sortedSteps[i] = steps[secondHalfCounter + Mathf.CeilToInt(amountOfTargets / 2f)]; secondHalfCounter++; } isFirstHalf = !isFirstHalf; } return(sortedSteps.ToList()); }