コード例 #1
0
        // Select the object in world space , according to touch input on the screen
        private void SelectObject(LeanFinger finger)
        {
            // Select Finger as input ONLY if the touch did not start over a GUI object
            if (!finger.StartedOverGui == true)
            {
                // Ray that is cast from the point of touch on screen into the world
                Ray ray;
                // First Object the Raycast hits
                RaycastHit hit;

                // Cast Ray
                ray = fpsCam.ScreenPointToRay(finger.ScreenPosition);
                // If Ray hits any object specified on the layerMask
                if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
                {
                    // Check if the hit object is an Exhibit
                    if (hit.collider.CompareTag("Exhibit"))
                    {
                        selectedObject = hit.collider.gameObject;
                        viewObjectScript.GetObjectToBeViewed(selectedObject);
                        textObjectSelected.text = selectedObject.transform.name;
                    }
                    // Else Find such an object in its Parent Recurisvely
                    else
                    {
                        selectedObject = GetParentWithTag(hit.collider.gameObject, "Exhibit");
                        if (selectedObject != null)
                        {
                            // Display Selected Object's Name
                            textObjectSelected.text = selectedObject.transform.name;
                            // Get the Object Ready for View
                            viewObjectScript.GetObjectToBeViewed(selectedObject);
                            // Get the Object's Description Ready in Object Viewer
                            viewObjectScript.GetDescription(selectedObject);
                        }
                    }
                }
            }
        }
コード例 #2
0
// Load Exhibit at Current Wishlist Index to Object Viewer
    public void LoadExhibit()
    {
        if (Wishlist.Count > 0)
        {
            if (wishlistIndex >= Wishlist.Count)
            {
                wishlistIndex = Wishlist.Count - 1;
            }
            // Get ObjectViewer Ready - Destroy Exisiting objects, Get Current Object, Load it in Viewer
            ViewObjectScript.DestroyAllChildren();
            ViewObjectScript.StartObjectViewer();
            ViewObjectScript.GetObjectToBeViewed(Exhibits.GetChild(Wishlist [wishlistIndex].index).gameObject);
            ViewObjectScript.ViewSelectedObject();
        }
    }