public IEnumerator introduceObject(ObjectOfInterest objectOfInterest)
    {
        //audioSource.clip = objectOfInterest.introductionSound;
        //audioSource.Play();
        speechOut.Speak(objectOfInterest.description);

        PantoHandle pantoHandle = objectOfInterest.isOnUpper
            ? (PantoHandle)GetPantoGameObject().GetComponent <UpperHandle>()
            : (PantoHandle)GetPantoGameObject().GetComponent <LowerHandle>();

        if (objectOfInterest.traceShape)
        {
            List <GameObject> children = new List <GameObject>();
            foreach (Transform child in objectOfInterest.transform)
            {
                children.Add(child.gameObject);
            }
            children.Sort((GameObject g1, GameObject g2) => g1.name.CompareTo(g2.name));
            yield return(pantoHandle.TraceObjectByPoints(children, 0.2f));
        }
        else
        {
            yield return(pantoHandle.SwitchTo(objectOfInterest.gameObject, 0.2f));
        }
        GetPantoGameObject().GetComponent <LowerHandle>().Free();
        GetPantoGameObject().GetComponent <UpperHandle>().Free();
    }
    void Start()
    {
        upperHandle = GameObject.Find("Panto").GetComponent <UpperHandle>();
        health      = GetComponent <Health>();
        audioSource = GetComponent <AudioSource>();

        bpmCoefficient = (endBPM - startBPM) / Mathf.Pow(health.maxHealth, 2);
    }
 void InitializePantoHandle()
 {
     if (isUpper)
     {
         pantoHandle = GetPantoGameObject().GetComponent <UpperHandle>();
     }
     else
     {
         pantoHandle = GetPantoGameObject().GetComponent <LowerHandle>();
     }
 }
    async public void NextTask()
    {
        Debug.Log("Task id " + currentTaskId);
        Debug.Log("Chunk id " + currentChunkId);

        // need to subtract taskChunkSize for the training block
        if (currentTaskId == taskCount - taskChunkSize)
        {
            Debug.Log("Finished study");
            Debug.Log(taskCount);
            speech.Speak("Well done, you've completed the user study. Thanks for participating!", 1);
            studyUIManager.FinishStudy();
        }
        else
        {
            StudyTask t = tasks[currentChunkId][currentTaskInChunk];
            Debug.Log("New task " + t.ToString());
            obstacleManager.DisableAll();
            PantoHandle handle = GameObject.Find("Panto").GetComponent <UpperHandle>();
            await Task.Delay(1000);

            await handle.MoveToPosition(t.startPos, 0.0005f, false);

            await speech.Speak("3, 2, 1, Go", 1);

            handle.Free();
            if (firstTrial)
            {
                // enable the walls of the scene after moving the handle for the first time
                //to make sure the handle is within the bounds of the room
                await obstacleManager.EnableWalls();

                firstTrial = false;
            }
            obstacleManager.ReEnableTarget(t.targetPos, new Vector3(t.targetSize, t.targetSize, t.targetSize));
            Debug.Log("Condition " + t.condition);
            if (t.guidesEnabled)
            {
                obstacleManager.ReEnableRails(t.targetPos, t.guideWidth, t.condition);
            }
            else
            {
                if (t.condition == "forcefield")
                {
                    obstacleManager.EnableForceField();
                }
            }

            startTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
            isRunning = true;
        }
    }