Detects drag and drop interactions on a Game Object, and sends events to all Flowchart event handlers in the scene. The Game Object must have Collider2D & RigidBody components attached. The Collider2D must have the Is Trigger property set to true. The RigidBody would typically have the Is Kinematic property set to true, unless you want the object to move around using physics. Use in conjunction with the Drag Started, Drag Completed, Drag Cancelled, Drag Entered & Drag Exited event handlers.
Inheritance: UnityEngine.MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler, IPointerEnterHandler, IPointerExitHandler
コード例 #1
0
 public virtual void OnDragStarted(Draggable2D draggableObject)
 {
     if (draggableObject == this.draggableObject)
     {
         ExecuteSequence();
     }
 }
コード例 #2
0
ファイル: DragCancelled.cs プロジェクト: tomcat7607/fungus
 public virtual void OnDragCancelled(Draggable2D draggableObject)
 {
     if (draggableObject == this.draggableObject)
     {
         ExecuteBlock();
     }
 }
コード例 #3
0
		public virtual void OnDragCancelled(Draggable2D draggableObject)
		{
			if (draggableObject == this.draggableObject)
			{
				ExecuteBlock();
			}
		}
コード例 #4
0
 /// <summary>
 /// Called by the Draggable2D object when the the drag enters the drag target.
 /// </summary>
 public virtual void OnDragEntered(Draggable2D draggableObject, Collider2D targetObject)
 {
     if (draggableObject == this.draggableObject &&
         targetObject == this.targetObject)
     {
         ExecuteBlock();
     }
 }
コード例 #5
0
 public virtual void OnDragExited(Draggable2D draggableObject, Collider2D targetObject)
 {
     if (draggableObject == this.draggableObject &&
         targetObject == this.targetObject)
     {
         ExecuteSequence();
     }
 }
コード例 #6
0
ファイル: DragEntered.cs プロジェクト: snozbot/fungus
 /// <summary>
 /// Called by the Draggable2D object when the the drag enters the drag target.
 /// </summary>
 public virtual void OnDragEntered(Draggable2D draggableObject, Collider2D targetObject)
 {
     if (draggableObject == this.draggableObject &&
         targetObject == this.targetObject)
     {
         ExecuteBlock();
     }
 }
コード例 #7
0
 /// <summary>
 /// Called by the Draggable2D object when the it exits the drag target.
 /// </summary>
 public virtual void OnDragExited(Draggable2D draggableObject, Collider2D targetObject)
 {
     if (this.targetObject != null &&
         draggableObject == this.draggableObject &&
         targetObject == this.targetObject)
     {
         overTarget = false;
     }
 }
コード例 #8
0
 /// <summary>
 /// Called by the Draggable2D object when the it exits the drag target.
 /// </summary>
 public virtual void OnDragExited(Draggable2D draggableObject, Collider2D targetObject)
 {
     if (this.targetObject != null &&
         draggableObject == this.draggableObject &&
         targetObject == this.targetObject)
     {
         overTarget = false;
     }
 }
コード例 #9
0
 /// <summary>
 /// Called by the Draggable2D object when the it exits the drag target.
 /// </summary>
 public virtual void OnDragExited(Draggable2D draggableObject, Collider2D targetObject)
 {
     if (this.targetObjects != null && this.draggableObjects != null &&
         this.draggableObjects.Contains(draggableObject) &&
         this.targetObjects.Contains(targetObject))
     {
         overTarget     = false;
         targetCollider = null;
     }
 }
コード例 #10
0
ファイル: DragCancelled.cs プロジェクト: JE-00/j-esquerra
 public virtual void OnDragCancelled(Draggable2D draggableObject)
 {
     if (draggableObjects.Contains(draggableObject))
     {
         if (draggableRef != null)
         {
             draggableRef.Value = draggableObject.gameObject;
         }
         ExecuteBlock();
     }
 }
コード例 #11
0
ファイル: DragCompleted.cs プロジェクト: alwayssea/fungus
 /// <summary>
 /// Called by the Draggable2D object when the it enters the drag target.
 /// </summary>
 public virtual void OnDragEntered(Draggable2D draggableObject, Collider2D targetObject)
 {
     if (draggableObject.BeingDragged &&
         this.targetObjects != null && this.draggableObjects != null &&
         this.draggableObjects.Contains(draggableObject) &&
         this.targetObjects.Contains(targetObject))
     {
         overTarget     = true;
         targetCollider = targetObject;
     }
 }
コード例 #12
0
ファイル: DragCancelled.cs プロジェクト: JE-00/j-esquerra
 void ISerializationCallbackReceiver.OnAfterDeserialize()
 {
     //add any dragableobject already present to list for backwards compatability
     if (draggableObject != null)
     {
         if (!draggableObjects.Contains(draggableObject))
         {
             draggableObjects.Add(draggableObject);
         }
         draggableObject = null;
     }
 }
コード例 #13
0
        /// <summary>
        /// Called by the Draggable2D object when the the drag ends over the drag target.
        /// </summary>
        public virtual void OnDragCompleted(Draggable2D draggableObject)
        {
            if (draggableObject == this.draggableObject &&
                overTarget)
            {
                // Assume that the player will have to do perform another drag and drop operation
                // to complete the drag again. This is necessary because we don't get an OnDragExited if the
                // draggable object is set to be inactive.
                overTarget = false;

                ExecuteBlock();
            }
        }
コード例 #14
0
 /// <summary>
 /// Called by the Draggable2D object when the the drag ends over the drag target.
 /// </summary>
 public virtual void OnDragCompleted(Draggable2D draggableObject)
 {
     if (draggableObject == this.draggableObject &&
         overTarget)
     {
         // Assume that the player will have to do perform another drag and drop operation
         // to complete the drag again. This is necessary because we don't get an OnDragExited if the
         // draggable object is set to be inactive.
         overTarget = false;
         
         ExecuteBlock();
     }
 }
コード例 #15
0
ファイル: DragEntered.cs プロジェクト: JE-00/j-esquerra
 /// <summary>
 /// Called by the Draggable2D object when the the drag enters the drag target.
 /// </summary>
 public virtual void OnDragEntered(Draggable2D draggableObject, Collider2D targetObject)
 {
     if (this.targetObjects != null && this.draggableObjects != null &&
         this.draggableObjects.Contains(draggableObject) &&
         this.targetObjects.Contains(targetObject))
     {
         if (draggableRef != null)
         {
             draggableRef.Value = draggableObject.gameObject;
         }
         if (targetRef != null)
         {
             targetRef.Value = targetObject.gameObject;
         }
         ExecuteBlock();
     }
 }
コード例 #16
0
        private void Awake()
        {
            //add any dragableobject already present to list for backwards compatability
            if (draggableObject != null)
            {
                if (!draggableObjects.Contains(draggableObject))
                {
                    draggableObjects.Add(draggableObject);
                }
            }

            if (targetObject != null)
            {
                if (!targetObjects.Contains(targetObject))
                {
                    targetObjects.Add(targetObject);
                }
            }
            draggableObject = null;
            targetObject    = null;
        }
コード例 #17
0
        /// <summary>
        /// Called by the Draggable2D object when the the drag ends over the drag target.
        /// </summary>
        public virtual void OnDragCompleted(Draggable2D draggableObject)
        {
            if (this.draggableObjects.Contains(draggableObject) &&
                overTarget)
            {
                // Assume that the player will have to do perform another drag and drop operation
                // to complete the drag again. This is necessary because we don't get an OnDragExited if the
                // draggable object is set to be inactive.
                if (draggableRef != null)
                {
                    draggableRef.Value = draggableObject.gameObject;
                }
                if (targetRef != null)
                {
                    targetRef.Value = targetCollider.gameObject;
                }

                overTarget     = false;
                targetCollider = null;

                ExecuteBlock();
            }
        }
コード例 #18
0
ファイル: DragStarted.cs プロジェクト: csantacruza/Reporte
 public DragStartedEvent(Draggable2D draggableObject)
 {
     DraggableObject = draggableObject;
 }
コード例 #19
0
ファイル: DragEntered.cs プロジェクト: snozbot/fungus
 public DragEnteredEvent(Draggable2D draggableObject, Collider2D targetCollider)
 {
     DraggableObject = draggableObject;
     TargetCollider = targetCollider;
 }
コード例 #20
0
ファイル: DragCompleted.cs プロジェクト: snozbot/fungus
 public DragCompletedEvent(Draggable2D draggableObject)
 {
     DraggableObject = draggableObject;
 }
コード例 #21
0
 public DragCompletedEvent(Draggable2D draggableObject)
 {
     DraggableObject = draggableObject;
 }
コード例 #22
0
ファイル: DragCancelled.cs プロジェクト: tomcat7607/fungus
 public DragCancelledEvent(Draggable2D draggableObject)
 {
     DraggableObject = draggableObject;
 }
コード例 #23
0
ファイル: DragStarted.cs プロジェクト: snozbot/fungus
 public DragStartedEvent(Draggable2D draggableObject)
 {
     DraggableObject = draggableObject;
 }
コード例 #24
0
ファイル: DragCancelled.cs プロジェクト: snozbot/fungus
 public DragCancelledEvent(Draggable2D draggableObject)
 {
     DraggableObject = draggableObject;
 }
コード例 #25
0
 public DragExitedEvent(Draggable2D draggableObject, Collider2D targetCollider)
 {
     DraggableObject = draggableObject;
     TargetCollider  = targetCollider;
 }