Example #1
0
    /// <summary>
    /// </summary>
    protected void OnEnable()
    {
        tracker = GameObject.Find("TrackerObject");
        markerSwitch = this.gameObject.GetComponent<MultiMarkerSwitch>();

        GUICanvas = GameObject.Find("Canvas").GetComponent<Canvas>();
        selectionText = GameObject.Find("ITSelectionText").GetComponent<Text>();
        ArrowImage = GameObject.Find("SelectionArrow");

        //selectionText.enabled = false;
        GUICanvas.enabled = false;

        // set init data
        StartUpData();

        /* ------------------ VRUE Tasks START --------------------------
        * find ITs (components) attached to interaction game object
        * if none is attached, manually attach 3 ITs to interaction game object
        * initially det default IT
        ----------------------------------------------------------------- */
        selectionActive = false;

        GenerateITList();

        // ------------------ VRUE Tasks END ----------------------------
    }
Example #2
0
    /// <summary>
    /// </summary>
    void OnEnable()
    {
        // set init data
        StartUpData();
        Debug.Log("IT Selection GUI enabled");

        /* ------------------ VRUE Tasks START --------------------------
        * find ITs (components) attached to interaction game object
        * if none is attached, manually attach 3 ITs to interaction game object
        * initially det default IT
        ----------------------------------------------------------------- */

        //get the multiMarkerSwitch Script
        mmSwitch = gameObject.GetComponent<MultiMarkerSwitch>();

        //disable GUI
        guiEnabled = false;
        guiPanel = GameObject.Find ("GUIPanel");
        guiPanel.GetComponent<Image> ().enabled = true;
        guiText = GameObject.Find ("GUIText").GetComponent<Text>();
        guiText.enabled = true;
        guiPanel.SetActive (false);

        virtualHand = GameObject.Find (_vh);

        itComponents = new List<ObjectSelectionBase> ();

        ObjectSelectionBase[] allItComponents = GameObject.FindObjectsOfType<ObjectSelectionBase> ();

        //go through all ObjectSelectionBase and find the one that are attached to the virtual hand
        foreach (ObjectSelectionBase osb in allItComponents)
        {
            if(osb.gameObject == virtualHand)
            {
                itComponents.Add(osb);
            }
        }

        // if no ObjectSelectionBase components are attached to the virtualHand then add three of them
        if(itComponents.Count == 0)
        {
            //add them to the component and to the itComponents list
            itComponents.Add(virtualHand.AddComponent<VirtualHandInteraction>() as VirtualHandInteraction);
            itComponents.Add(virtualHand.AddComponent<GoGoInteraction>() as GoGoInteraction);
            itComponents.Add(virtualHand.AddComponent<HomerInteraction>() as HomerInteraction);
        }

        //disable all except the VirtualHandInteraction
        foreach (ObjectSelectionBase osb in itComponents)
        {
            if(osb.GetType().ToString().Equals("VirtualHandInteraction"))
            {
                //activate the VirtualHandInteraction
                osb.enabled = true;
            }
            else
            {
                osb.enabled = false;
            }
        }

        // ------------------ VRUE Tasks END ----------------------------
    }