Browse Source

Fixed DragCompleted handlers firing incorrectly.

master
chrisgregan 10 years ago
parent
commit
e066f9c2d8
  1. 7
      Assets/Fungus/Sprite/Scripts/EventHandlers/DragCompleted.cs

7
Assets/Fungus/Sprite/Scripts/EventHandlers/DragCompleted.cs

@ -25,6 +25,7 @@ namespace Fungus
public virtual void OnDragEntered(Draggable2D draggableObject, Collider2D targetObject) public virtual void OnDragEntered(Draggable2D draggableObject, Collider2D targetObject)
{ {
if (this.targetObject != null && if (this.targetObject != null &&
draggableObject == this.draggableObject &&
targetObject == this.targetObject) targetObject == this.targetObject)
{ {
overTarget = true; overTarget = true;
@ -34,6 +35,7 @@ namespace Fungus
public virtual void OnDragExited(Draggable2D draggableObject, Collider2D targetObject) public virtual void OnDragExited(Draggable2D draggableObject, Collider2D targetObject)
{ {
if (this.targetObject != null && if (this.targetObject != null &&
draggableObject == this.draggableObject &&
targetObject == this.targetObject) targetObject == this.targetObject)
{ {
overTarget = false; overTarget = false;
@ -45,6 +47,11 @@ namespace Fungus
if (draggableObject == this.draggableObject && if (draggableObject == this.draggableObject &&
overTarget) 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;
ExecuteSequence(); ExecuteSequence();
} }
} }

Loading…
Cancel
Save