Beispiel #1
0
        public void Tapped()
        {
            // If we've already got a bounding box and it's pointing to us, do nothing
            if (boundingBox != null && boundingBox.Target == this.gameObject)
            {
                return;
            }

            // Try to find our bounding box
            if (boundingBox == null)
            {
                boundingBox = GameObject.FindObjectOfType <BoundingBoxManipulate>();
                if (boundingBox == null)
                {
                    Debug.LogError("Couldn't find bounding box for object " + name);
                    return;
                }
            }

            // Try to find our toolbar
            if (toolbar == null)
            {
                toolbar = GameObject.FindObjectOfType <AppBar>();
                if (toolbar == null)
                {
                    // This is only a problem if we want to display one
                    if (ShowAppBar)
                    {
                        Debug.LogError("Couldn't find toolbar for object " + name);
                        return;
                    }
                }
            }

            // Set the bounding box's target and permitted operations
            boundingBox.PermittedOperations = PermittedOperations;
            boundingBox.Target = gameObject;

            if (ShowAppBar)
            {
                // Show it and set its bounding box object
                toolbar.BoundingBox = boundingBox;
                toolbar.Reset();
            }
            else if (toolbar != null)
            {
                // Set its bounding box to null to hide it
                toolbar.BoundingBox = null;
                // Set to accept input immediately
                boundingBox.AcceptInput = true;
            }
        }
Beispiel #2
0
        public void Tapped()
        {
            // Return if there isn't a Manipulation Manager
            if (ManipulationManager.Instance == null)
            {
                Debug.LogError("No manipulation manager for " + name);
                return;
            }

            // Try to find our bounding box
            if (boundingBox == null)
            {
                boundingBox = ManipulationManager.Instance.ActiveBoundingBox;
            }

            // Try to find our toolbar
            if (toolbar == null)
            {
                toolbar = ManipulationManager.Instance.ActiveAppBar;
            }

            // If we've already got a bounding box and it's pointing to us, do nothing
            if (boundingBox != null && boundingBox.gameObject.activeSelf && boundingBox.Target == this.gameObject)
            {
                return;
            }

            // Set the bounding box's target and permitted operations
            boundingBox.PermittedOperations = PermittedOperations;
            boundingBox.FlattenPreference   = FlattenPreference;
            boundingBox.Target = gameObject;
            boundingBox.BoundsMethodOverride = BoundsCalculationMethod;
            boundingBox.gameObject.SetActive(true);

            if (ShowAppBar)
            {
                // Show it and set its bounding box object
                toolbar.BoundingBox = boundingBox;
                toolbar.Reset();
                toolbar.gameObject.SetActive(true);
            }
            else if (toolbar != null)
            {
                // Set its bounding box to null to hide it
                toolbar.BoundingBox = null;
                // Set to accept input immediately
                boundingBox.AcceptInput = true;
            }
        }