Inheritance: UnityEngine.MonoBehaviour
        public void StopDrag()
        {
            RestoreColliderSize ();

            if (OnObjectStopDrag != null)
                OnObjectStopDrag();

            if (isBeingDragged)
                Snap();

            isBeingDragged = false;

            if (objectBeingDragged == this)
                objectBeingDragged = null;

            if (dragSound != null)
                dragSound.Stop();
        }
        private void StartDrag()
        {
            lastDragPosition = myTransform.position;
            startDragDirection = new Vector3();
            EnlargeColliderSize ();
            isBeingDragged = true;
            objectBeingDragged = this;
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            float distance1 = 0f;
            if (horizontalPlane.Raycast(ray, out distance1))
                inputStartOffset = transform.position - ray.GetPoint(distance1);

            if (dragSound != null)
                dragSound.Play();
        }
Exemple #3
0
 protected virtual void Awake()
 {
     myTransform = transform;
     snaper = GetComponent<SnapItemToCloserPosition> ();
     dragObject = GetComponent<DraggableObject> ();
     controllerToStop = GetComponent<TotemControllerStop> ();
     highlightObject = GetComponent<HighlightObject> ();
     myAnimator = GetComponentInChildren<Animator>();
     validTypes.Add (TotemType.Triangle);
     validTypes.Add (TotemType.Sphere);
     validTypes.Add (TotemType.Square);
 }