Esempio n. 1
0
    private void DismissFitbox()
    {
        // Destroy the GestureRecognizer ...
        recognizer.CancelGestures();
        recognizer.StopCapturingGestures();
        recognizer.Dispose();
        recognizer = null;

        // ... show the hologram collection ...
        if (HologramCollection)
        {
            HologramCollection.SetActive(true);
            Menu.SetActive(true);

            if (MoveCollectionOnDismiss)
            {
                // Update the Hologram Collection's position so it shows up
                // where the Fitbox left off. Start with the camera's localRotation...
                camQuat = Camera.main.transform.localRotation;

                // ... ignore pitch by disabling rotation around the x axis
                camQuat.x = 0;
                camQuat.z = 0;

                // Rotate the vector and factor y back into the position
                newPosition   = camQuat * collectionStartingOffsetFromCamera;
                newPosition.y = collectionStartingOffsetFromCamera.y;

                // Position was "Local Position" so add that to where the camera is now
                cameraPosition = Camera.main.transform.position;
                HologramCollection.transform.position = cameraPosition + newPosition;

                // Rotate the Hologram Collection to face the user.
                toQuat   = Camera.main.transform.localRotation * HologramCollection.transform.rotation;
                toQuat.x = 0;
                toQuat.z = 0;
                HologramCollection.transform.rotation = toQuat;
            }
        }

        // ... and Destroy the Fitbox
        //Destroy(gameObject);
        gameObject.SetActive(false);
        GameObject.Find("Manager").GetComponent <Load>().FileNumber = 0;
    }