/// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }
            if (!guidList.Contains(grabbedGuid))
            {
                //guidList.Add(grabbedGuid);
                gameObject.GetComponent <NodeLink>().Fire("UnlockItem", grabbedGuid);
            }



            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();



            isDragging = false;
            //isAvailable = true;
            currentInputSource   = null;
            currentInputSourceId = 0;
            if (hostRigidbody != null)
            {
                hostRigidbody.isKinematic = hostRigidbodyWasKinematic;
            }
            StoppedDragging.RaiseEvent();
        }
Esempio n. 2
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            //--hier habe ich losgelassen!
            Debug.Log("####### RELEASE THE CRAKENNNN!!!! ######");


            GameObject toolbox = GameObject.FindGameObjectWithTag("testCubeToolbox");

            if (toolbox.GetComponent <ToolboxRaycaster>().lookingAtToolbox())
            {
                //GameObject.FindGameObjectWithTag("testCubeToolbox").GetComponent<ToolboxRaycaster>().attachNodeToToolbox();
                //GetComponent<NodeToParentMapper>.attachNodeToToolbox();
                GetComponent <NodeToParentMapper>().attachNodeToToolbox();
            }

            isDragging           = false;
            currentInputSource   = null;
            currentInputSourceId = 0;
            if (hostRigidbody != null)
            {
                hostRigidbody.isKinematic = hostRigidbodyWasKinematic;
            }
            StoppedDragging.RaiseEvent();
        }
Esempio n. 3
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            isDragging           = false;
            _isDragging          = false;
            currentInputSource   = null;
            currentInputSourceId = 0;
            if (hostRigidbody != null)
            {
                hostRigidbody.isKinematic = hostRigidbodyWasKinematic;
                draggingRigid             = null; //
            }

            /*
             * if (_hostRigidbody != null) {
             *  _hostRigidbody.isKinematic = _hostRigidbodyWasKinematic;
             * }
             */
            StoppedDragging.RaiseEvent();
        }
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (IsBeingPlaced == IsBeingPlacedStates.No)
            {
                return;
            }

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            IsBeingPlaced = IsBeingPlacedStates.No;

            currentInputSource = null;
            StoppedDragging.RaiseEvent();

            if (spatialMappingManager != null)
            {
                spatialMappingManager.DrawVisualMeshes = false;
            }
            if (EnablePersistenceInWorldAnchor)
            {
                // Add world anchor when object placement is done.
                anchorManager.AttachAnchor(gameObject, SavedAnchorFriendlyName);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            isDragging         = false;
            currentInputSource = null;
            StoppedDragging.RaiseEvent();

            throwVector = (HostTransform.position - prevPos) * UserStrong;



            if (gameObject.GetComponent <Rigidbody>())
            {
                if (gravity)
                {
                    gameObject.GetComponent <Rigidbody>().useGravity = true;
                }
                gameObject.GetComponent <Rigidbody>().isKinematic = false;
                //gameObject.GetComponent<Rigidbody>().velocity = Vector3.zero;
                gameObject.GetComponent <Rigidbody>().AddForce(throwVector);

                //Debug.Log(throwVector);
            }
        }
Esempio n. 6
0
        // From HandDraggable.cs
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        private void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            isDragging         = false;
            currentInputSource = null;
            StoppedDragging.RaiseEvent();
        }
Esempio n. 7
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            isDragging = false;

            isShareDrag = 0;

            //放したら壁に貼り付ける
            //if (shoutotu == true)
            //{
            //    obj.transform.position = placementPosition;
            //    obj.transform.rotation = rotation;

            //    pos = placementPosition;
            //    rot = rotation;

            //    body = obj.GetComponent<Rigidbody>();
            //    body.isKinematic = true;

            //    obj.transform.transform.Find("HoloStickyUI").transform.transform.Find("Image").GetComponent<StickyFaceMe>().enabled = false;
            //    obj.transform.transform.Find("BackFace").GetComponent<StickyFaceMe>().enabled = false;

            //    sendFlag = 1;

            //    int ind = Data.shareStickyList.IndexOf(obj);
            //    if (ind != -1)
            //    {
            //        Data.WallStickyList[ind] = 1;

            //        //CustomMessages.Instance.SendMovePos(pos, rot, ind, isShareDrag);
            //    }


            //    ind = -1;
            //    obj = null;
            //    shoutotu = false;

            //}

            index = -1;
            //isDragging = false;
            currentInputSource = null;
            StoppedDragging.RaiseEvent();
        }
Esempio n. 8
0
        /// <summary>
        /// Stop dragging
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }
            isDragging = false;
            if (hostRigidbody != null)
            {
                hostRigidbody.isKinematic = hostRigidbodyWasKinematic;
            }

            StoppedDragging.RaiseEvent();
        }
Esempio n. 9
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            isDragging         = false;
            currentInputSource = null;
            StoppedDragging.RaiseEvent();
        }
Esempio n. 10
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            // Remove self as a modal input handler
            //TODO: is this double stacking of input handlers bad?
            //InputManager.Instance.PopModalInputHandler();

            isDragging = false;
            StoppedDragging.RaiseEvent();
        }
Esempio n. 11
0
        /// <summary>
        /// オブジェクトのドラッグを止める
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            // モーダル入力対象から自身を削除する
            InputManager.Instance.PopModalInputHandler();

            isDragging           = false;
            currentInputSource   = null;
            currentInputSourceId = 0;
            StoppedDragging.RaiseEvent();
        }
Esempio n. 12
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            this.GetComponentInParent <Rigidbody>().useGravity = true;
            if (!isDragging)
            {
                return;
            }

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            isDragging         = false;
            currentInputSource = null;
            StoppedDragging.RaiseEvent();
        }
Esempio n. 13
0
    public void StopDragging()
    {
        if (!isDragging)
        {
            return;
        }

        InputManager.Instance.PopModalInputHandler();

        isDragging                   = false;
        currentInputSource           = null;
        rend.material.color          = defaultColor;
        gizmoSetting.IsDraggingMover = false;
        StoppedDragging.RaiseEvent();
    }
Esempio n. 14
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            isDragging = false;
            GameObject.Find("StageCollection").SendMessage("UpdateDragging", "null");
            Debug.Log("Stopped Dragging " + this.name);
            currentInputSource = null;
            StoppedDragging.RaiseEvent();
        }
Esempio n. 15
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            isDragging         = false;
            currentInputSource = null;
            StoppedDragging.RaiseEvent();

            // Restore the world anchor
            SendMessageUpwards("OnAddAnchor", this.gameObject);
        }
Esempio n. 16
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            gameObject.GetComponent <Rigidbody>().AddForce((gameObject.transform.position - lastPosition) * 750);
            gameObject.GetComponent <Rigidbody>().useGravity = true;

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            isDragging         = false;
            currentInputSource = null;
            StoppedDragging.RaiseEvent();
        }
Esempio n. 17
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }


            inventory.dropToSlot(transform); // pass in global position
            transform.localPosition = startPosition;

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            isDragging         = false;
            currentInputSource = null;
            StoppedDragging.RaiseEvent();
        }
Esempio n. 18
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            Vector3 ballPosition = newHandPosition;

            // Calculate throwing force
            //float displacementY = target.transform.position.y - ballPosition.y;
            //Vector3 displacementXZ = new Vector3(target.transform.position.x - ballPosition.x, 0, target.transform.position.z - ballPosition.z);

            //float hitTime = Vector3.Magnitude(displacementXZ) / velocity;
            //Vector3 velocityY = Vector3.up * displacementY / hitTime - 0.5f * Physics.gravity * hitTime;
            //Vector3 velocityXZ = displacementXZ / hitTime;

            pokeballInstance.isKinematic = false;

            handDeltaMovement = newHandPosition - startHandPosition;
            var scaleProduct = Vector3.Scale(Camera.main.transform.right, handDeltaMovement);
            var force        = draggingTime > 0 ? 2 * (handDeltaMovement * (scaleProduct.x + scaleProduct.y + scaleProduct.z) / handDeltaMovement.magnitude + handDeltaMovement) / draggingTime : Vector3.zero;

            pokeballInstance.AddForce(force, ForceMode.Impulse);
            pokeballInstance.GetComponent <Collider>().enabled = true;

            if (isFirstBall)
            {
                pokeballInstance.GetComponent <PokeballLogic>().isFirstBall = true;
                isFirstBall = false;
            }

            draggingTime = 0;

            debugText.text = force.ToString("F3");

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            isDragging         = false;
            currentInputSource = null;
            StoppedDragging.RaiseEvent();
        }
Esempio n. 19
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            //put hidden object back
            for (int i = 0; i < objectsToHide.Length; i++)
            {
                objectsToHide[i].SetActive(true); //or renderer instead?
            }

            isDragging         = false;
            currentInputSource = null;
            StoppedDragging.RaiseEvent();
        }
Esempio n. 20
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            isDragging         = false;
            currentInputSource = null;

            if (popupMenu)
            {
                popupMenu.parent = null;
                popupMenu.gameObject.SetActive(true);
            }

            StoppedDragging.RaiseEvent();
        }
    //On stop drag, release input and snap to grid
    public void StopDragging(bool forceToInitial)
    {
        if (!isDragging)
        {
            return;
        }

        // Remove self as a modal input handler
        InputManager.Instance.PopModalInputHandler();

        isDragging           = false;
        currentInputSource   = null;
        currentInputSourceId = 0;
        if (hostRigidbody != null)
        {
            hostRigidbody.isKinematic = hostRigidbodyWasKinematic;
        }
        StoppedDragging.RaiseEvent();

        //Now we snap the object to a fixed grid
        SnapBodyToGrid(forceToInitial);
    }
Esempio n. 22
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                return;
            }

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            isDragging           = false;
            currentInputSource   = null;
            currentInputSourceId = 0;
            if (hostRigidbody != null)
            {
                hostRigidbody.isKinematic = hostRigidbodyWasKinematic;
            }
            StoppedDragging.RaiseEvent();

            //var BoundingBox = gameObject.GetComponent<UX.BoundingBoxRig>();//daniel
            // BoundingBox.GetBounds(); //daniel
        }
    /// <summary>
    /// Stops dragging the object.
    /// </summary>
    public void StopDragging()
    {
        if (!isDragging)
        {
            if (comparePos())
            {
                // change gameObject color to green, and play ding sound clip
                // gameObject.GetComponent<Renderer>().material.color = new Color32(0, 254, 111, 1);
                if (gameObject.transform.childCount > 1)
                {
                    foreach (Transform child in gameObject.transform)
                    {
                        child.GetComponent <Renderer>().material.color = new Color32(0, 254, 111, 1);
                    }
                }
                else
                {
                    gameObject.GetComponent <Renderer>().material.color = new Color32(0, 254, 111, 1);
                }

                audioSource.PlayOneShot(dingSound, 0.1f);
                //gameObject.transform.position = Vector3.Lerp(gameObject.transform.position, spawnPos, 1.5f/150);
                //float step = speed * Time.deltaTime;
                //transform.position = Vector3.MoveTowards(transform.position, spawnPos, 1.5f / 150);
                //gameObject.transform.position.x = spawnPos.x;
                transform.position = new Vector3(spawnPos.x, spawnPos.y, spawnPos.z);
            }

            return;
        }

        // Remove self as a modal input handler
        InputManager.Instance.PopModalInputHandler();

        isDragging         = false;
        currentInputSource = null;
        StoppedDragging.RaiseEvent();
    }
Esempio n. 24
0
        /// <summary>
        /// Stops dragging the object.
        /// </summary>
        public void StopDragging()
        {
            if (!isDragging)
            {
                GetComponent <Rigidbody>().useGravity = true;
                return;
            }

            // Remove self as a modal input handler
            InputManager.Instance.PopModalInputHandler();

            isDragging         = false;
            currentInputSource = null;
            StoppedDragging.RaiseEvent();

            picked = false;
            GetComponent <Rigidbody>().isKinematic = false;

            if (snapped)
            {
                Vector3 size = myCollider.size;
                size.y          = 0.1f;
                myCollider.size = size;
                GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePosition | RigidbodyConstraints.FreezeRotation;

                for (int i = 0; i < meshRenderers.Length; ++i)
                {
                    meshRenderers[i].material = defaultMaterial;
                }
                trainEvent.Solved = true;
            }
            else
            {
                Vector3 size = myCollider.size;
                size.y          = 0.2f;
                myCollider.size = size;
            }
        }