Example #1
0
        /// <summary>
        /// This initializes the tooltip objects
        /// </summary>
        void InitializeIndividualTooltips()
        {
            for (int i = 0; i < individualTooltips.Length; i++)
            {
                VRTK_ObjectTooltip tooltip = individualTooltips[i];

                switch (tooltip.name.Replace("Tooltip", "").ToLower())
                {
                case "trigger":
                    triggerTooltip = tooltip;
                    break;

                case "grip":
                    gripTooltip = tooltip;
                    break;

                case "touchpad":
                    touchpadTooltip = tooltip;
                    break;

                case "buttonone":
                    buttonOne = tooltip;
                    break;

                case "buttontwo":
                    buttonTwo = tooltip;
                    break;
                }
            }
        }
Example #2
0
    /// <summary>
    /// Construct the Interactable Map
    /// </summary>
    /// <param name="points">The results of the triangulator</param>
    /// <param name="name">The name of the map</param>
    /// <param name="objToSpawn">GameObject which is going to contain the map instance</param>
    /// <param name="bounds">Bounds of the shape</param>
    /// <param name="parentName">Name of the parent map</param>
    /// <param name="reportGrabbed">Delegate function, which the map instance uses to report grabbed</param>
    /// <returns></returns>
    ///
    internal void Constructor(Vector2[] points, string name, GameObject objToSpawn, float[] bounds, string parentName, Action <bool> reportGrabbed)
    {
        T          = new Triangulator(points);
        vertices3D = Array.ConvertAll <Vector2, Vector3>(points, v => v);

        this.reportGrabbed = reportGrabbed;
        this.name          = name;
        this.parentName    = parentName;
        this.centerX       = (bounds[0] + bounds[2]) / 2F;
        this.centerY       = (bounds[1] + bounds[3]) / 2F;


        this.go             = Instantiate(Resources.Load("MapToolTip")) as GameObject;
        go.transform.parent = this.wrapper.transform;
        VRTK_ObjectTooltip tooltip = go.GetComponent <VRTK_ObjectTooltip>();

        tooltip.alwaysFaceHeadset = true;
        tooltip.displayText       = this.name;
        tooltip.alwaysFaceHeadset = true;
        this.go.SetActive(false);


        this.objToSpawn      = objToSpawn;
        this.objToSpawn.name = name;

        this.DrawObject();


        CreateLineAroundState();

        //this.AddToList(parentName, name);
    }
 /// <summary>
 /// Changes the colors of the tooltip's container, line, and font for after a tutorial step
 /// </summary>
 /// <param name="toggling">The Tooltips script instance to use for toggling the tooltips of the corresponding controller the script is attached to</param>
 /// <param name="tooltip">The tooltip to change the color of</param>
 public void ChangeTooltipColorAfterTutorialStep(Tooltips toggling, VRTK_ObjectTooltip tooltip)
 {
     toggling.ChangeContainerColor(tooltip, tipBackgroundColor_AfterTutorialStep);
     toggling.ChangeLineColor(tooltip, tipLineColor_AfterTutorialStep);
     toggling.ChangeFontColor(tooltip, tipTextColor_AfterTutorialStep);
     tooltip.ResetTooltip();
 }
Example #4
0
    private void Start()
    {
        //make sure tooltip is off
        if (tooltip != null)
        {
            tooltip.SetActive(false);

            VRTK_ObjectTooltip tooltipScript = tooltip.GetComponent <VRTK_ObjectTooltip>();

            if (tooltipScript != null)
            {
                if (tooltipScript.drawLineTo == null)
                {
                    tooltipScript.drawLineFrom = transform;
                }
            }
        }

        //if button is a UI button, get color
        buttonImage = GetComponent <Image>();
        button_UI   = GetComponent <Button>();
        if (buttonImage != null)
        {
            uiButtonOriginalColor = buttonImage.color;
        }
    }
Example #5
0
    // Use this for initialization
    void Start()
    {
        GameController = GameObject.Find("GameController").GetComponent <AnatomyGameController>();
        GameController.Unanwsered.Add(this.gameObject);

        if (PreferedName == null || PreferedName == "")
        {
            PreferedName = MainParent.name;
        }

        toolTipOfObject = this.GetComponent <VRTK_ObjectTooltip>();

        Invoke("setup", 0.05f);
    }
Example #6
0
        /// <summary>
        /// This function determines the behavior of the tooltip when the corresponding button is released
        /// </summary>
        /// <param name="tooltip">The tooltip which should have its behavior changed</param>
        /// <param name="tooltipButton">The button that corresponds to the tooltip</param>
        private void DoTooltipReleased(VRTK_ObjectTooltip tooltip, VRTK_ControllerTooltips.TooltipButtons tooltipButton)
        {
            Debug.Log("1" + tooltip.containerColor);
            Debug.Log("2" + tutorial.tipBackgroundColor_DuringTutorialStep);
            if (tooltip.containerColor != tutorial.tipBackgroundColor_DuringTutorialStep)
            {
                tooltips.ToggleTips(false, tooltipButton);
            }

            /*
             * switch (tooltipButton)
             * {
             *  case VRTK_ControllerTooltips.TooltipButtons.TriggerTooltip:
             *      if (gameObject.name == "LeftController" || (Tutorial.currentTutorialState != Tutorial.TutorialState.GRABZONE
             *              && Tutorial.currentTutorialState != Tutorial.TutorialState.PRIMARYPLACEMENT
             *              && Tutorial.currentTutorialState != Tutorial.TutorialState.SECONDARYPLACEMENT))
             *      {
             *          tooltips.ToggleTips(false, tooltipButton);
             *      }
             *      break;
             *  case VRTK_ControllerTooltips.TooltipButtons.GripTooltip:
             *      if ((gameObject.name == "LeftController" && Tutorial.currentTutorialState != Tutorial.TutorialState.SCALINGMAP)
             || (Tutorial.currentTutorialState != Tutorial.TutorialState.SELECTIONPOINTER
             ||         && Tutorial.currentTutorialState != Tutorial.TutorialState.SECONDARYPLACEMENT
             ||         && Tutorial.currentTutorialState != Tutorial.TutorialState.SCALINGMAP))
             ||     {
             ||         tooltips.ToggleTips(false, tooltipButton);
             ||     }
             ||     break;
             || case VRTK_ControllerTooltips.TooltipButtons.TouchpadTooltip:
             ||     if ((gameObject.name == "LeftController" && Tutorial.currentTutorialState != Tutorial.TutorialState.MOVINGMAP)
             || (gameObject.name == "RightController" && Tutorial.currentTutorialState != Tutorial.TutorialState.ROTATINGMAP))
             ||     {
             ||         tooltips.ToggleTips(false, tooltipButton);
             ||     }
             ||     break;
             || case VRTK_ControllerTooltips.TooltipButtons.ButtonTwoTooltip:
             ||     if (gameObject.name == "LeftController"
             || (gameObject.name == "RightController" && Tutorial.currentTutorialState != Tutorial.TutorialState.UNDOANDDELETE))
             ||     {
             ||         tooltips.ToggleTips(false, tooltipButton);
             ||     }
             ||     break;
             ||}*/
        }
Example #7
0
    /// <summary>
    /// Enable the tooltip OnPointerEnter.
    /// </summary>
    /// <param name="changeText">Delegate function to updae the tooltip text</param>
    /// <returns></returns>
    ///
    public override void OnPointerEnter(Action <string> changeText)
    {
        this.color.a = 0.3F;
        this.meshRenderer.material.color = this.color;
        VRTK_ObjectTooltip tooltip = go.GetComponent <VRTK_ObjectTooltip>();

        var inc_flow = Mathf.Max(0, this.getMapController().getData(this.name, this.parentName, true));

        var out_flow = Mathf.Max(0, this.getMapController().getData(this.name, this.parentName, false));

        var text = this.name + ": \n" + inc_flow.ToString("N0") + "Moved In \n" + out_flow.ToString("N0") + " Moved Out";


        //changeText(text);
        tooltip.displayText = text;

        //this.go.SetActive(true);
    }
Example #8
0
    private void Start()
    {
        source = GetComponent <AudioSource>();

        if (tooltip != null)
        {
            tooltip.SetActive(false);

            VRTK_ObjectTooltip tooltipScript = tooltip.GetComponent <VRTK_ObjectTooltip>();

            if (tooltipScript != null)
            {
                if (tooltipScript.drawLineTo == null)
                {
                    tooltipScript.drawLineFrom = transform;
                }
            }
        }
    }
Example #9
0
 /// <summary>
 /// This function is used as a helper to get a TooltipButtons enum item given a tooltip object
 /// </summary>
 /// <param name="tooltip">This is the tooltip that we want the corresponding enum item of</param>
 /// <returns>This is the corresponding enum item</returns>
 public VRTK_ControllerTooltips.TooltipButtons ChangeTooltipToButton(VRTK_ObjectTooltip tooltip)
 {
     if (tooltip.Equals(triggerTooltip))
     {
         return(VRTK_ControllerTooltips.TooltipButtons.TriggerTooltip);
     }
     else if (tooltip.Equals(gripTooltip))
     {
         return(VRTK_ControllerTooltips.TooltipButtons.GripTooltip);
     }
     else if (tooltip.Equals(touchpadTooltip))
     {
         return(VRTK_ControllerTooltips.TooltipButtons.TouchpadTooltip);
     }
     else if (tooltip.Equals(buttonOne))
     {
         return(VRTK_ControllerTooltips.TooltipButtons.ButtonOneTooltip);
     }
     else if (tooltip.Equals(buttonTwo))
     {
         return(VRTK_ControllerTooltips.TooltipButtons.ButtonTwoTooltip);
     }
     throw new System.ArgumentException("Parameter must be a valid tooltip");
 }
Example #10
0
 void Start()
 {
     ammoTooltip = ammoTooltipGameObject.GetComponent <VRTK_ObjectTooltip>();
 }
 /// <summary>
 /// Observable ObjectTooltipTextUpdated event
 /// </summary>
 /// <param name="events"></param>
 /// <returns></returns>
 public static IObservable <ObjectTooltipEventArgs> ObjectTooltipTextUpdatedAsObservable(this VRTK_ObjectTooltip events)
 {
     return(Observable.FromEvent <ObjectTooltipEventHandler, ObjectTooltipEventArgs>(
                h => (s, e) => h(e),
                h => events.ObjectTooltipTextUpdated += h,
                h => events.ObjectTooltipTextUpdated -= h));
 }
Example #12
0
    // calculate average temperature and change sensor coloring
    public void ChangeColor()
    {
        int buildingNumber = Int32.Parse(this.transform.parent.parent.parent.parent.name.Remove(0, 9));

        if (si.tempAvg.Length > 0)           // if has sensor information for the current sensor
        // print sensor information
        //Debug.Log ("Building: " + buildingNumber + ", Sensor: " + this.name + ", Avg temp:" + si.tempAvg [buildingNumber - 1]);

        {
            float tempValue = si.tempAvg [buildingNumber - 1];

            if (tempValue >= 27)
            {
                Color cl27 = new Color();
                ColorUtility.TryParseHtmlString("#d73027", out cl27);
                this.GetComponent <Renderer> ().material.color = cl27;
                this.GetComponent <Renderer>().material.SetColor("_OutlineColor", cl27);

                this.transform.localScale = new Vector3(1, 1, 2.6f);
            }
            else if (tempValue >= 26 & tempValue < 27)
            {
                Color cl26 = new Color();
                ColorUtility.TryParseHtmlString("#f46d43", out cl26);
                this.GetComponent <Renderer> ().material.color = cl26;
                this.GetComponent <Renderer>().material.SetColor("_OutlineColor", cl26);

                this.transform.localScale = new Vector3(1, 1, 2.4f);
            }
            else if (tempValue >= 25 & tempValue < 26)
            {
                Color cl25 = new Color();
                ColorUtility.TryParseHtmlString("#ffc800", out cl25);
                this.GetComponent <Renderer> ().material.color = cl25;
                this.GetComponent <Renderer>().material.SetColor("_OutlineColor", cl25);


                this.transform.localScale = new Vector3(1, 1, 2.2f);
            }
            else if (tempValue >= 24 & tempValue < 25)
            {
                Color cl24 = new Color();
                ColorUtility.TryParseHtmlString("#ffffbf", out cl24);
                this.GetComponent <Renderer> ().material.color = cl24;
                this.GetComponent <Renderer>().material.SetColor("_OutlineColor", cl24);

                this.transform.localScale = new Vector3(1, 1, 2f);
            }
            else if (tempValue >= 23 & tempValue < 24)
            {
                Color cl23 = new Color();
                ColorUtility.TryParseHtmlString("#8aff00", out cl23);
                this.GetComponent <Renderer> ().material.color = cl23;
                this.GetComponent <Renderer>().material.SetColor("_OutlineColor", cl23);

                this.transform.localScale = new Vector3(1, 1, 1.8f);
            }
            else if (tempValue >= 22 & tempValue < 23)
            {
                Color cl22 = new Color();
                ColorUtility.TryParseHtmlString("#1a9850", out cl22);
                this.GetComponent <Renderer> ().material.color = cl22;
                this.GetComponent <Renderer>().material.SetColor("_OutlineColor", cl22);

                this.transform.localScale = new Vector3(1, 1, 1.6f);
            }
            else if (tempValue >= 21 & tempValue < 22)
            {
                Color cl21 = new Color();
                ColorUtility.TryParseHtmlString("#00fff4", out cl21);
                this.GetComponent <Renderer> ().material.color = cl21;
                this.GetComponent <Renderer>().material.SetColor("_OutlineColor", cl21);

                this.transform.localScale = new Vector3(1, 1, 1.4f);
            }
            else if (tempValue >= 20 & tempValue < 21)
            {
                Color cl20 = new Color();
                ColorUtility.TryParseHtmlString("#0064ff", out cl20);
                this.GetComponent <Renderer> ().material.color = cl20;
                this.GetComponent <Renderer>().material.SetColor("_OutlineColor", cl20);

                this.transform.localScale = new Vector3(1, 1, 1.2f);
            }
            else
            {
                Color cl19 = new Color();
                ColorUtility.TryParseHtmlString("#542788", out cl19);
                this.GetComponent <Renderer> ().material.color = cl19;
                this.GetComponent <Renderer>().material.SetColor("_OutlineColor", cl19);

                this.transform.localScale = new Vector3(1, 1, 1);
            }

            this.GetComponent <Renderer>().material.shader = silhouetteShader;
            this.GetComponent <Renderer>().material.SetFloat("_Outline", 0.001f);

            //			if (tempValue <= tempLow) { // low temperature
            //				this.GetComponent<Renderer> ().material.color = Color.blue;
            //			} else if (tempValue <= tempHigh) { // medium temperature
            //				this.GetComponent<Renderer> ().material.color = Color.yellow;
            //			} else {// high temperature
            //				this.GetComponent<Renderer> ().material.color = Color.red;
            //			}
            tooltip = (GameObject)Instantiate(ToolTipPrefab, new Vector3(0, 0, 0), Quaternion.identity);
            tooltip.transform.SetParent(this.transform);
            if (this.name.Contains("G"))
            {
                this.transform.localScale       = new Vector3(1, 1, this.transform.localScale.z * 1.7f);
                tooltip.transform.localPosition = new Vector3(0, 0, 0.8f / 1.7f);
            }
            else
            {
                tooltip.transform.localPosition = new Vector3(0, 0, 0.8f);
            }
            tooltip.transform.localScale = new Vector3(30, 30 / this.transform.localScale.z, 30);

            tooltip.name = this.name.Trim() + " tooltip";

            VRTK_ObjectTooltip ot = tooltip.GetComponent <VRTK_ObjectTooltip>();
            ot.displayText = this.name.Trim();
        }
        else  // no info snesor
        {
            Color lightGray = new Color();
            ColorUtility.TryParseHtmlString("#969696", out lightGray);
//			Color blueSensor = new Color ();
//			ColorUtility.TryParseHtmlString ("#1d91c0", out blueSensor);
            this.GetComponent <Renderer> ().material.color = lightGray;
        }
        initiated = true;
    }
    /// <summary>
    /// Draw a series of maps, parsing the geoJSON file.
    /// </summary>
    /// <returns></returns>
    ///
    public void drawMultipleMaps(GameObject gameObject, Action <bool> report_grabbed, string dataFile, int level, string parentName, Vector3 scale, InteractableMap parent = null, bool haveTooltip = true
                                 , float centerX = 0, float centerY = 0, int number = 0)
    {
        //bool done = false;
        int count = 0;

        gameObject.transform.SetPositionAndRotation(new Vector3(number, 0, 0), new Quaternion(0, 0, 0, 1));

        List <Tuple <Vector2[], float[], string> > drawingData = new List <Tuple <Vector2[], float[], string> >();

        //StreamReader inp_stm = new StreamReader(dataFile);

        foreach (string inp_ln in dataFile.Split('\n'))
        {
            try
            {
                float maxX = -10000000, maxY = -10000000;
                float minX = 10000000, minY = 10000000;

                //string inp_ln = inp_stm.ReadLine();

                string currentName = NAME_REGEX.Match(inp_ln).Groups[1].ToString();

                string coordinates = COORDS_REGEX.Match(inp_ln).Groups[1].ToString();



                MatchCollection matches    = _convert.Matches(coordinates);
                Vector2[]       vertices2D = new Vector2[matches.Count];
                int             indices    = 0;

                foreach (Match match in matches)
                {
                    float x, y;

                    string[] data = match.Groups[1].ToString().Split(',');

                    (x, y) = convert(float.Parse(data[1]), float.Parse(data[0]));

                    vertices2D[indices] = new Vector2(x, y);

                    maxX = Mathf.Max(x, maxX);
                    maxY = Mathf.Max(y, maxY);
                    minX = Mathf.Min(x, minX);
                    minY = Mathf.Min(y, minY);

                    indices++;
                    count++;
                    //Debug.Log(x.ToString() + "," + y.ToString());
                }

                float[] bounds = new float[] { maxX, maxY, minX, minY };

                drawingData.Add(new Tuple <Vector2[], float[], string>(vertices2D, bounds, currentName));
            }
            catch
            {
            }
        }

        var totalMaxX = Mathf.Max(drawingData.Select(x => x.Item2[0]).ToArray());
        var totalMaxY = Mathf.Max(drawingData.Select(x => x.Item2[1]).ToArray());
        var totalMinX = Mathf.Min(drawingData.Select(x => x.Item2[2]).ToArray());
        var totalMinY = Mathf.Min(drawingData.Select(x => x.Item2[3]).ToArray());


        var TmpcenterX = (totalMaxX + totalMinX) / 2;
        var TmpcenterY = (totalMaxY + totalMinY) / 2;


        var area = (totalMaxX - totalMinX) * (totalMaxY - totalMinY);

        var factor = Mathf.Sqrt(FINAL_AREA / area) * (parentName == "America" ? 5 : 1);

        drawingData = drawingData.Select(x => new Tuple <Vector2[], float[], string>(x.Item1.Select(y => new Vector2(y.x * factor, y.y * factor)).ToArray(),
                                                                                     new float[] { x.Item2[0] * factor, x.Item2[1] * factor, x.Item2[2] * factor, x.Item2[3] * factor },
                                                                                     x.Item3)).ToList();


        totalMaxX = Mathf.Max(drawingData.Select(x => x.Item2[0]).ToArray());
        totalMaxY = Mathf.Max(drawingData.Select(x => x.Item2[1]).ToArray());
        totalMinX = Mathf.Min(drawingData.Select(x => x.Item2[2]).ToArray());
        totalMinY = Mathf.Min(drawingData.Select(x => x.Item2[3]).ToArray());


        TmpcenterX = (totalMaxX + totalMinX) / 2;
        TmpcenterY = (totalMaxY + totalMinY) / 2;

        area = (totalMaxX - totalMinX) * (totalMaxY - totalMinY);

        var children = new List <InteractableMap>();

        foreach (var data in drawingData)
        {
            GameObject temp = new GameObject();
            temp.transform.parent = gameObject.transform;

            InteractableMap pointableObject = temp.AddComponent(getType(level)) as InteractableMap;

            string currentName = data.Item3;
            pointableObject.SetParent(gameObject.transform);

            pointableObject.Constructor(data.Item1, data.Item3, temp, data.Item2, parentName, report_grabbed);
            children.Add(pointableObject);



            if (parent != null)
            {
                parent.AddChild(pointableObject);
                pointableObject.parent = parent;
            }
        }

        float maximumY = 0;

        List <float> x2 = new List <float>();
        List <float> y2 = new List <float>();

        foreach (var child in children)
        {
            child.SetPositionAndRotation(new Vector3(0, 0), child.GetAngle());
            child.SetSiblings(children);
            maximumY = Mathf.Max(maximumY, child.transform.parent.position.y);

            x2.Add(child.transform.parent.localPosition.x);
            y2.Add(child.transform.parent.localPosition.y);
        }
        Debug.Log(x2.Average());
        Debug.Log(y2.Average());

        foreach (var child in children)
        {
            //child.SetPositionAndRotation(new Vector3(-x2.Average(), -y2.Average()), child.GetAngle());
            //child.wrapper.transform.Translate(new Vector3(-x2.Average(), -y2.Average(), 0), Space.Self);
            child.wrapper.transform.localPosition += new Vector3(-x2.Average(), -y2.Average());
            //child.SetSiblings(children);
            //maximumY = Mathf.Max(maximumY, child.transform.parent.position.y);

            //x2.Add(child.transform.parent.position.x);
            //y2.Add(child.transform.parent.position.y);
        }

        gameObject.transform.SetPositionAndRotation(new Vector3(0 - centerX, 0 - centerY, 0), children[0].GetFinalAngle());


        if (level != (int)LEVEL.COUNTY_LEVEL && haveTooltip)
        {
            GameObject objectToolTip = UnityEngine.Object.Instantiate(Resources.Load("ObjectTooltip")) as GameObject;
            objectToolTip.transform.parent = gameObject.transform;

            objectToolTip.transform.localPosition = new Vector3(0, maximumY + 0.15F, 0);

            VRTK_ObjectTooltip tooltipData = objectToolTip.GetComponent <VRTK_ObjectTooltip>() as VRTK_ObjectTooltip;
            tooltipData.displayText = parentName;
            Text[] backend = tooltipData.GetComponentsInChildren <Text>() as Text[];
            backend.ToList().ForEach(x => x.text = parentName);
            tooltipData.drawLineFrom             = objectToolTip.transform;
            tooltipData.drawLineTo = objectToolTip.transform;
        }


        //gameObject.transform.SetPositionAndRotation(new Vector3(centerX, centerY, 0), children[0].GetFinalAngle());

        gameObject.transform.localPosition = new Vector3(0, 0, 0);
        //gameObject.transform.localScale = scale;
    }
 protected virtual void Awake()
 {
     tooltipScript             = GetComponent <VRTK_ObjectTooltip>();
     tooltipScript.displayText = transform.parent.name;
     tooltipScript.UpdateText(transform.parent.name);
 }
Example #15
0
 /// <summary>
 /// This function determines the behavior of the tooltip when the corresponding button is pressed
 /// </summary>
 /// <param name="tooltip">The tooltip which should have its behavior changed</param>
 /// <param name="tooltipButton">The button that corresponds to the tooltip</param>
 private void DoTooltipPressed(VRTK_ObjectTooltip tooltip, VRTK_ControllerTooltips.TooltipButtons tooltipButton)
 {
     tooltips.ToggleTips(true, tooltipButton);
 }
Example #16
0
 /// <summary>
 /// The function changes colour to use for the line drawn between the tooltip and the destination transform.
 /// </summary>
 /// <param name="tooltip">The tooltip that you want to change the color of</param>
 /// <param name="newColor">The color to be changed to</param>
 public void ChangeLineColor(VRTK_ObjectTooltip tooltip, Color newColor)
 {
     tooltip.lineColor = newColor;
 }
Example #17
0
 /// <summary>
 /// This function changes the colour to use for the text on the tooltip.
 /// </summary>
 /// <param name="tooltip">The tooltip that you want to change the color of</param>
 /// <param name="newColor">The color to be changed to</param>
 public void ChangeFontColor(VRTK_ObjectTooltip tooltip, Color newColor)
 {
     tooltip.fontColor = newColor;
 }
Example #18
0
 /// <summary>
 /// This function changes the colour to use for the background container of the tooltip.
 /// </summary>
 /// <param name="tooltip">The tooltip that you want to change the color of</param>
 /// <param name="newColor">The color to be changed to</param>
 public void ChangeContainerColor(VRTK_ObjectTooltip tooltip, Color newColor)
 {
     tooltip.containerColor = newColor;
 }
        /*    void CheckAction<T>(AudioRef audio, Func<T> currentState, T state)
         *   {
         *       bool isPlaying = audio.Value.isPlaying;
         *       while (isPlaying)
         *       {
         *           if (currentState().Equals(state))
         *           {
         *               Debug.Log(currentState());
         *               stepFinished = true;
         *               return;
         *           }
         *           isPlaying = audio.Value.isPlaying;
         *       }
         *   }
         *
         *   IEnumerator CheckAction<T> (Func<T> currentState, T state)
         *   {
         *       if (!stepFinished)
         *       {
         *           Debug.Log(currentState());
         *           yield return new WaitUntil(() => currentState().Equals(state));
         *       }
         *       stepFinished = false;
         *   }
         */

        /// <summary>
        /// Plays the audio of the tutorial step, and shows the tooltip of the corresponding button and additional givin tooltip if there is one.
        /// Waits until does the task mentioned in the tutorial step.
        /// </summary>
        /// <param name="audio">The audio to play for the tutorial step</param>
        /// <param name="button">The button that is required for the tutorial step, of which its tooltip should show</param>
        /// <param name="tooltip">Additional tooltip object that should show if needed for the tutorial step, null if only one tooltip is needed.</param>
        /// <param name="controller">If controller is -1 then left only, 0 then both, 1 then right controller only</param>
        /// <returns></returns>
        IEnumerator TutorialStep(AudioSource audio, VRTK_ControllerTooltips.TooltipButtons button, VRTK_ObjectTooltip tooltip, int controller)
        {
            audio.Play();

            //change tooltip colors to the color during tutorial step
            if (controller <= 0)
            {
                ChangeTooltipColorDuringTutorialStep(leftToggling, leftToggling.ChangeButtonToTooltip(button));
                leftTooltips.ToggleTips(true, button);
            }
            if (controller >= 0)
            {
                if (tooltip != null)
                {
                    ChangeTooltipColorDuringTutorialStep(rightToggling, tooltip);
                    rightTooltips.ToggleTips(true, rightToggling.ChangeTooltipToButton(tooltip));
                }
                ChangeTooltipColorDuringTutorialStep(rightToggling, rightToggling.ChangeButtonToTooltip(button));
                rightTooltips.ToggleTips(true, button);
            }
            //CheckAction(audio, currentState, state);
            yield return(new WaitForSecondsRealtime(audio.clip.length));

            //yield return StartCoroutine(CheckAction(currentState, state));

            yield return(new WaitUntil(() => stepFinished)); //wait until step is finished before continuing tutorial

            //change tooltip colors once step is finished
            if (controller <= 0)
            {
                ChangeTooltipColorAfterTutorialStep(leftToggling, leftToggling.ChangeButtonToTooltip(button));
                leftTooltips.ToggleTips(false, button);
            }
            if (controller >= 0)
            {
                if (tooltip != null)
                {
                    ChangeTooltipColorAfterTutorialStep(rightToggling, tooltip);
                    rightTooltips.ToggleTips(false, rightToggling.ChangeTooltipToButton(tooltip));
                }
                ChangeTooltipColorAfterTutorialStep(rightToggling, rightToggling.ChangeButtonToTooltip(button));
                rightTooltips.ToggleTips(false, button);
            }

            //set it back to false for the next step
            stepFinished = false;
        }