Пример #1
0
    // Responsible for checking if the user has clicked a hotspot, and if so, triggering the hotspot
    void HasClickedHotspot()
    {
        if (overGuiButton == false)
        {
            RaycastHit hit;

            Ray ray = panoCamera.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out hit, 100))
            {
                if (hit.collider.gameObject.GetComponent <HotSpot>() != null)
                {
                    HotSpot hotSpot = hit.collider.gameObject.GetComponent <HotSpot>();
                    hotSpot.Execute(" triggered by mouse");
                }
            }
        }
    }
Пример #2
0
    // Responsible for checking if the user has touched a hotspot, and if so, triggering the hotspot
    void HasTouchedHotspot()
    {
        if (Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Ended)
        {
            if (canTouchHotspot && overGuiButton == false)
            {
                RaycastHit hit;

                Ray ray = panoCamera.ScreenPointToRay(Input.GetTouch(0).position);

                if (Physics.Raycast(ray, out hit, 100))
                {
                    if (hit.collider.gameObject.GetComponent <HotSpot>() != null)
                    {
                        HotSpot hotSpot = hit.collider.gameObject.GetComponent <HotSpot>();
                        hotSpot.Execute(" triggered by touch device");
                    }
                }
            }
        }
    }