Esempio n. 1
0
 public override void Update(float deltaTime)
 {
     Current_DragAreaIndicator = CheckCurrentDragAreaIndicator();
     if (ForbidDrag)
     {
         CancelCurrentAndLastDrag();
     }
     else
     {
         CheckDragStartOrEnd();
     }
 }
Esempio n. 2
0
        private DragAreaIndicator CheckCurrentDragAreaIndicator()
        {
            foreach (DragProcessor dragProcessor in DragProcessors)
            {
                DragAreaIndicator dragAreaIndicator = dragProcessor.GetCurrentDragAreaIndicator();
                if (dragAreaIndicator != null)
                {
                    return(dragAreaIndicator);
                }
            }

            return(null);
        }
Esempio n. 3
0
        public DragAreaIndicator GetCurrentDragAreaIndicator()
        {
            Ray ray = Camera.ScreenPointToRay(CurrentMousePosition_Screen);

            RaycastHit[] hits = Physics.RaycastAll(ray, MaxRaycastDistance, DragManager.Instance.DragAreaLayerMask);
            foreach (RaycastHit hit in hits)
            {
                if (hit.collider)
                {
                    DragAreaIndicator dai = hit.collider.gameObject.GetComponentInParent <DragAreaIndicator>();
                    if (dai != null)
                    {
                        return(dai);
                    }
                }
            }

            return(null);
        }
Esempio n. 4
0
        public void SetOnDrag(bool drag, Collider collider, DragProcessor dragProcessor)
        {
            if (isDragging != drag)
            {
                if (drag) // Press
                {
                    MyDragProcessor = dragProcessor;
                    caller.Draggable_SetStates(ref canDrag, ref dragFrom_DragAreaIndicator);
                    if (canDrag)
                    {
                        StartDragPos = MyDragProcessor.CurrentMousePosition_World;
                        caller.Draggable_OnMouseDown(dragFrom_DragAreaIndicator, collider);
                        isDragging = true;
                    }
                    else
                    {
                        isDragging = false;
                        DragManager.Instance.CancelCurrentAndLastDrag();
                    }
                }
                else // Release
                {
                    if (canDrag)
                    {
                        caller.Draggable_OnMouseUp(DragManager.Instance.Current_DragAreaIndicator, MyDragProcessor.CurrentMousePosition_World - StartDragPos, MyDragProcessor.DeltaMousePosition_World);
                        DragManager.Instance.CurrentDrag = null;
                    }
                    else
                    {
                        DragManager.Instance.CurrentDrag = null;
                    }

                    dragFrom_DragAreaIndicator = null;
                    isDragging      = false;
                    MyDragProcessor = null;
                }
            }
        }