protected void InternalZoneCompleted() { curZoneCount += 1; Vector2 lastWaypoint = data.waypoints[data.waypoints.Count - 1]; Vector2 currentWaypoint = new Vector2(ZoneTransform.position.x, ZoneTransform.position.z); float dist = Vector2.Distance(lastWaypoint, currentWaypoint); //record our data: data.times.Add(timeSinceLastCollection); data.waypoints.Add(currentWaypoint); data.distancesWaypoint.Add(dist); data.distancesMoved.Add(currentWaypointDistanceMoved); //reset variables currentWaypointDistanceMoved = 0; timeSinceLastCollection = 0f; //if we're done, add the final data and finish if (curZoneCount >= NumTestZones) { StepDetector.instance.OnStepDetected -= OnStepDetected; if (isPractice) { DataRecorder.FinishPractice(); } else { data.totalDistanceTraveled = totalDistanceMoved; data.totalTime = totalTime; data.totalSteps = totalSteps; DataRecorder.FinishRun(data); } } else { bool obstacle = ShouldHaveObstacle(curZoneCount); SetZonePosition(obstacle); } }