v3.6.1 Documentation
Fungus.Draggable2D Class Reference

Detects drag and drop interactions on a Game Object, and sends events to all Flowchart event handlers in the scene. More...

Inheritance diagram for Fungus.Draggable2D:

Public Member Functions

void RegisterHandler (DragCompleted handler)
 
void UnregisterHandler (DragCompleted handler)
 
void OnBeginDrag (PointerEventData eventData)
 
void OnDrag (PointerEventData eventData)
 
void OnEndDrag (PointerEventData eventData)
 
void OnPointerEnter (PointerEventData eventData)
 
void OnPointerExit (PointerEventData eventData)
 

Protected Member Functions

virtual void LateUpdate ()
 
virtual void OnTriggerEnter2D (Collider2D other)
 
virtual void OnTriggerExit2D (Collider2D other)
 
virtual void DoBeginDrag ()
 
virtual void DoDrag ()
 
virtual void DoEndDrag ()
 
virtual void DoPointerEnter ()
 
virtual void DoPointerExit ()
 
virtual void ChangeCursor (Texture2D cursorTexture)
 
virtual void OnMouseDown ()
 
virtual void OnMouseDrag ()
 
virtual void OnMouseUp ()
 
virtual void OnMouseEnter ()
 
virtual void OnMouseExit ()
 

Protected Attributes

bool dragEnabled = true
 
bool returnOnCancelled = true
 
bool returnOnCompleted = true
 
float returnDuration = 1f
 
Texture2D hoverCursor
 
bool useEventSystem
 
Vector3 startingPosition
 
bool updatePosition = false
 
Vector3 newPosition
 
Vector3 delta = Vector3.zero
 
List< DragCompleteddragCompletedHandlers = new List<DragCompleted>()
 

Properties

virtual bool DragEnabled [get, set]
 Is object drag and drop enabled. More...
 

Detailed Description

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.

Definition at line 18 of file Draggable2D.cs.

Member Function Documentation

◆ ChangeCursor()

virtual void Fungus.Draggable2D.ChangeCursor ( Texture2D  cursorTexture)
protectedvirtual

Definition at line 176 of file Draggable2D.cs.

◆ DoBeginDrag()

virtual void Fungus.Draggable2D.DoBeginDrag ( )
protectedvirtual

Definition at line 96 of file Draggable2D.cs.

◆ DoDrag()

virtual void Fungus.Draggable2D.DoDrag ( )
protectedvirtual

Definition at line 111 of file Draggable2D.cs.

◆ DoEndDrag()

virtual void Fungus.Draggable2D.DoEndDrag ( )
protectedvirtual

Definition at line 127 of file Draggable2D.cs.

◆ DoPointerEnter()

virtual void Fungus.Draggable2D.DoPointerEnter ( )
protectedvirtual

Definition at line 166 of file Draggable2D.cs.

◆ DoPointerExit()

virtual void Fungus.Draggable2D.DoPointerExit ( )
protectedvirtual

Definition at line 171 of file Draggable2D.cs.

◆ LateUpdate()

virtual void Fungus.Draggable2D.LateUpdate ( )
protectedvirtual

Definition at line 61 of file Draggable2D.cs.

◆ OnBeginDrag()

void Fungus.Draggable2D.OnBeginDrag ( PointerEventData  eventData)

Definition at line 242 of file Draggable2D.cs.

◆ OnDrag()

void Fungus.Draggable2D.OnDrag ( PointerEventData  eventData)

Definition at line 254 of file Draggable2D.cs.

◆ OnEndDrag()

void Fungus.Draggable2D.OnEndDrag ( PointerEventData  eventData)

Definition at line 266 of file Draggable2D.cs.

◆ OnMouseDown()

virtual void Fungus.Draggable2D.OnMouseDown ( )
protectedvirtual

Definition at line 188 of file Draggable2D.cs.

◆ OnMouseDrag()

virtual void Fungus.Draggable2D.OnMouseDrag ( )
protectedvirtual

Definition at line 196 of file Draggable2D.cs.

◆ OnMouseEnter()

virtual void Fungus.Draggable2D.OnMouseEnter ( )
protectedvirtual

Definition at line 212 of file Draggable2D.cs.

◆ OnMouseExit()

virtual void Fungus.Draggable2D.OnMouseExit ( )
protectedvirtual

Definition at line 220 of file Draggable2D.cs.

◆ OnMouseUp()

virtual void Fungus.Draggable2D.OnMouseUp ( )
protectedvirtual

Definition at line 204 of file Draggable2D.cs.

◆ OnPointerEnter()

void Fungus.Draggable2D.OnPointerEnter ( PointerEventData  eventData)

Definition at line 278 of file Draggable2D.cs.

◆ OnPointerExit()

void Fungus.Draggable2D.OnPointerExit ( PointerEventData  eventData)

Definition at line 290 of file Draggable2D.cs.

◆ OnTriggerEnter2D()

virtual void Fungus.Draggable2D.OnTriggerEnter2D ( Collider2D  other)
protectedvirtual

Definition at line 72 of file Draggable2D.cs.

◆ OnTriggerExit2D()

virtual void Fungus.Draggable2D.OnTriggerExit2D ( Collider2D  other)
protectedvirtual

Definition at line 84 of file Draggable2D.cs.

◆ RegisterHandler()

void Fungus.Draggable2D.RegisterHandler ( DragCompleted  handler)

Definition at line 47 of file Draggable2D.cs.

◆ UnregisterHandler()

void Fungus.Draggable2D.UnregisterHandler ( DragCompleted  handler)

Definition at line 52 of file Draggable2D.cs.

Member Data Documentation

◆ delta

Vector3 Fungus.Draggable2D.delta = Vector3.zero
protected

Definition at line 42 of file Draggable2D.cs.

◆ dragCompletedHandlers

List<DragCompleted> Fungus.Draggable2D.dragCompletedHandlers = new List<DragCompleted>()
protected

Definition at line 45 of file Draggable2D.cs.

◆ dragEnabled

bool Fungus.Draggable2D.dragEnabled = true
protected

Definition at line 21 of file Draggable2D.cs.

◆ hoverCursor

Texture2D Fungus.Draggable2D.hoverCursor
protected

Definition at line 34 of file Draggable2D.cs.

◆ newPosition

Vector3 Fungus.Draggable2D.newPosition
protected

Definition at line 41 of file Draggable2D.cs.

◆ returnDuration

float Fungus.Draggable2D.returnDuration = 1f
protected

Definition at line 31 of file Draggable2D.cs.

◆ returnOnCancelled

bool Fungus.Draggable2D.returnOnCancelled = true
protected

Definition at line 25 of file Draggable2D.cs.

◆ returnOnCompleted

bool Fungus.Draggable2D.returnOnCompleted = true
protected

Definition at line 28 of file Draggable2D.cs.

◆ startingPosition

Vector3 Fungus.Draggable2D.startingPosition
protected

Definition at line 39 of file Draggable2D.cs.

◆ updatePosition

bool Fungus.Draggable2D.updatePosition = false
protected

Definition at line 40 of file Draggable2D.cs.

◆ useEventSystem

bool Fungus.Draggable2D.useEventSystem
protected

Definition at line 37 of file Draggable2D.cs.

Property Documentation

◆ DragEnabled

virtual bool Fungus.Draggable2D.DragEnabled
getset

Is object drag and drop enabled.

true if drag enabled; otherwise, false.

Definition at line 236 of file Draggable2D.cs.


The documentation for this class was generated from the following file: