// Use this for initialization
    void Start()
    {
        // find player and floor
        player = GameObject.FindGameObjectWithTag("Player").transform;
        floor = GameObject.FindGameObjectWithTag("Floor");

        // assign the origin level part or block as the current part
        currentPart = floor.transform.FindChild("Origin").gameObject;
        currentConnectionPoints = currentPart.GetComponent<ConnectionPointManager>();

        // pick randomly the next part to be moved to the end of the level
        int nextPartIndex = Random.Range(0, parts.Length);
        nextPart = parts[nextPartIndex];
        nextConnectionPoints = nextPart.GetComponent<ConnectionPointManager>();
        currentPartIndex = nextPartIndex; // cycle indexes
    }
    void CycleParts()
    {
        currentPart = nextPart;
        currentConnectionPoints = nextConnectionPoints;

        // choose a random number and use it as index to pick a new part
        int nextPartIndex = Random.Range(0, parts.Length);
        // prevent the same part from being used twice
        while (nextPartIndex == currentPartIndex)
        {
            nextPartIndex = Random.Range(0, parts.Length);
        }
        nextPart = parts[nextPartIndex];
        currentPartIndex = nextPartIndex; // cycle indexes
        nextConnectionPoints = nextPart.GetComponent<ConnectionPointManager>();
    }
    void CycleParts()
    {
        currentPart             = nextPart;
        currentConnectionPoints = nextConnectionPoints;

        // choose a random number and use it as index to pick a new part
        int nextPartIndex = Random.Range(0, parts.Length);

        // prevent the same part from being used twice
        while (nextPartIndex == currentPartIndex)
        {
            nextPartIndex = Random.Range(0, parts.Length);
        }
        nextPart             = parts[nextPartIndex];
        currentPartIndex     = nextPartIndex; // cycle indexes
        nextConnectionPoints = nextPart.GetComponent <ConnectionPointManager>();
    }
    private int currentPartIndex; // for preventing the use of the same part twice in a row

    // Use this for initialization
    void Start()
    {
        // find player and floor
        player = GameObject.FindGameObjectWithTag("Player").transform;
        floor  = GameObject.FindGameObjectWithTag("Floor");

        // assign the origin level part or block as the current part
        currentPart             = floor.transform.FindChild("Origin").gameObject;
        currentConnectionPoints = currentPart.GetComponent <ConnectionPointManager>();

        // pick randomly the next part to be moved to the end of the level
        int nextPartIndex = Random.Range(0, parts.Length);

        nextPart             = parts[nextPartIndex];
        nextConnectionPoints = nextPart.GetComponent <ConnectionPointManager>();
        currentPartIndex     = nextPartIndex; // cycle indexes
    }