private IEnumerator GameSetupSequence(List <JSONObject> Robots, Action onDone)
    {
        //reset stats
        FindObjectOfType <AllRobotStats>().ResetStats();

        // pad out robots list if there are too few robots
        if (OverrideAddCPUPlayers >= 0)
        {
            AddCPUPlayers = OverrideAddCPUPlayers;
        }
        if (Robots.Count < AddCPUPlayers)
        {
            Robots.AddRange(ExampleRobotBuilder.ExampleRobotsJSON(AddCPUPlayers));
        }

        // delete existing robots
        foreach (RoombaMovement robot in FindObjectsOfType <RoombaMovement>())
        {
            Destroy(robot.gameObject);
        }

        // get references to objects in the scene
        var RobotBuilder = FindObjectOfType <BuildRobot>();

        Assert.IsNotNull(RobotBuilder, "BuildRobot needed");

        var Arena = FindObjectOfType <ShrinkArena>();

        Assert.IsNotNull(Arena, "Arena needed");

        // set the arena size
        yield return(Arena.GrowToSize(ArenaSizeForRobots(Robots.Count)));

        // dramatic pause
        yield return(new WaitForSeconds(DelayBeforeSpawning));

        // spawn robots
        Vector3 arenaCenter             = Arena.transform.position;
        float   spawnDistanceFromCenter = (ArenaSizeForRobots(Robots.Count) * 0.45f) - DistanceFromEdge; // 0.45 because 90% of half the diameter for hex shape

        float angle         = 0f;
        float angleInterval = (Mathf.PI * 2f) / Robots.Count;
        int   robotNumber   = 1;

        foreach (var robotJSONObject in Robots)
        {
            JSONArray robotParts = robotJSONObject["parts"].AsArray;
            string    robotName  = robotJSONObject["username"];

            // build robot from json
            var robot = RobotBuilder.build(robotParts.ToString(), robotName);
            robot.GetComponent <RoombaMovement>().ActivateOnStart = false;

            // place robot in circle on arena
            Vector3 spawnPosition =
                arenaCenter +                                    // spawn relative to center
                new Vector3(                                     // spawn in a circle
                    -Mathf.Cos(angle) * spawnDistanceFromCenter, // negative because the first one goes on the left of the screen
                    0f,
                    Mathf.Sin(angle) * spawnDistanceFromCenter
                    ) +
                Vector3.up * SpawnDistanceAboveGround; // go a bit above the arena floor

            robot.transform.position = spawnPosition;

            // look at center of arena
            robot.transform.LookAt(new Vector3(arenaCenter.x, robot.transform.position.y, arenaCenter.z));

            // increment values for next robot
            angle       += angleInterval;
            robotNumber += 1;

            // wait so robots appear one at a time
            yield return(new WaitForSeconds(SetupSequenceRobotSpawnInterval));
        }

        // pause before battle
        yield return(new WaitForSeconds(DelayAfterSpawning));

        // battle starts TODO: maybe this code goes somewhere else
        Arena.StartShrinkSequence();
        foreach (RoombaMovement robot in FindObjectsOfType <RoombaMovement>())
        {
            robot.Activate();
        }
        onDone();
    }
    private void StartSampleGame()
    {
        var exampleRobots = ExampleRobotBuilder.ExampleRobotsJSON(TEST_number_of_robots);

        SetupGame(exampleRobots, () => Debug.Log("Setup done"));
    }