C# Class UIDraggableElement, PuzzleGameProject

The UIDraggableElement is the element the MenuButton will spawn. This element is spawned so that there is always one and only one UIDraggableElement on top of the MenuButton when the button's count is greater than 0. This UIDraggableElement is Draggable so the player can move it around with its finger to the Square on the map he wants the corresponding Element to spawn.
Inheritance: MonoBehaviour, Draggable
Mostra file Open project: Cedric-Paris/PuzzleGameProject

Public Methods

Method Description
OnMouseDown ( ) : void

Implemented from the Draggable interface. If the object has a Collider, a touch or a click will drag the object. This method is called when the object is picked up by the mouse or finger. Here, we tell the associated MenuButton this UIDraggableElement was taken.

OnMouseDrag ( ) : void

Implemented from the Draggable interface. If the object has a Collider, a touch or a click will drag the object. Here, we make the UIDraggableElement follow the mouse's cursor.

OnMouseDrop ( ) : void

Implemented from the Draggable interface. If the object has a Collider, a touch or a click will drag the object. This method is called when the object is dropped by the mouse or finger. Here, we spawn the Element associated with this UIDraggableElement at the right position and destroy this object.

OnMouseUp ( ) : void

Implemented from the Draggable interface. If the object has a Collider, a touch or a click will drag the object. This method is called when the object is dropped by the mouse or finger. Here, we move the UIDraggableElement to its last position.

Protected Methods

Method Description
GetAssociatedMenuButtonName ( ) : string

Informs which button is associated with this UIDraggableElement.

GetElementBase ( ) : DraggableElement,

Informs which Element this UIDraggableElement has to spawn.

Private Methods

Method Description
CalculDemiLePlusProche ( float value ) : float

Calculates the nearest n.5 float.

Resize ( GameObject canvas ) : void

Resizes the UIDraggableElement so it matches the size of the correponding MenuButton.

Start ( ) : void

Initializes the UIDraggableElement.

UndoMoveUIDraggableElement ( ) : void

Returns the UIDraggableElement to its original place.

Method Details

GetAssociatedMenuButtonName() protected abstract method

Informs which button is associated with this UIDraggableElement.
protected abstract GetAssociatedMenuButtonName ( ) : string
return string

GetElementBase() protected abstract method

Informs which Element this UIDraggableElement has to spawn.
protected abstract GetElementBase ( ) : DraggableElement,
return DraggableElement,

OnMouseDown() public method

Implemented from the Draggable interface. If the object has a Collider, a touch or a click will drag the object. This method is called when the object is picked up by the mouse or finger. Here, we tell the associated MenuButton this UIDraggableElement was taken.
public OnMouseDown ( ) : void
return void

OnMouseDrag() public method

Implemented from the Draggable interface. If the object has a Collider, a touch or a click will drag the object. Here, we make the UIDraggableElement follow the mouse's cursor.
public OnMouseDrag ( ) : void
return void

OnMouseDrop() public method

Implemented from the Draggable interface. If the object has a Collider, a touch or a click will drag the object. This method is called when the object is dropped by the mouse or finger. Here, we spawn the Element associated with this UIDraggableElement at the right position and destroy this object.
public OnMouseDrop ( ) : void
return void

OnMouseUp() public method

Implemented from the Draggable interface. If the object has a Collider, a touch or a click will drag the object. This method is called when the object is dropped by the mouse or finger. Here, we move the UIDraggableElement to its last position.
public OnMouseUp ( ) : void
return void