private void Start()
 {
     _baseGrabbing             = GetComponent <BaseGrabbing>();
     _rigidbody                = GetComponent <Rigidbody>();
     _baseGrabbing.OnReleased += OnReleased;
     _baseGrabbing.OnGrabbed  += OnGrabbed;
 }
        /// <summary>
        /// Release object after grabbing
        /// </summary>
        /// <param name="sourceID"></param>
        public void OnStylusButtonUp(int sourceID)
        {
            if (sourceID != Globals.ACTION_BUTTON)
            {
                return;
            }

            if (BaseGrabbing != null)
            {
                BaseGrabbing.StopGrabbing(this);
                BaseGrabbing = null;
            }
        }
        /// <summary>
        /// Grabbing the focused object
        /// </summary>
        /// <param name="sourceID"></param>
        public void OnStylusButtonDown(int sourceID)
        {
            if (sourceID != Globals.ACTION_BUTTON)
            {
                return;
            }

            var focused = _input.FocusedObject.GameObject;

            if (focused != null)
            {
                var grabbing = focused.GetComponent <BaseGrabbing>();
                if (grabbing != null)
                {
                    BaseGrabbing = grabbing;
                    BaseGrabbing.StartGrabbing(this);
                }
            }
        }
 private void OnGrabbed(BaseGrabbing grabbing)
 {
     _state = ThrowState.Grabbed;
 }
 private void OnReleased(BaseGrabbing grabbing)
 {
     _state = ThrowState.Released;
 }