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
Afficher le fichier Open project: Cedric-Paris/PuzzleGameProject

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode Description
GetAssociatedMenuButtonName ( ) : string

Informs which button is associated with this UIDraggableElement.

GetElementBase ( ) : DraggableElement,

Informs which Element this UIDraggableElement has to spawn.

Private Methods

Méthode 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 méthode

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

GetElementBase() protected abstract méthode

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

OnMouseDown() public méthode

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
Résultat void

OnMouseDrag() public méthode

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
Résultat void

OnMouseDrop() public méthode

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
Résultat void

OnMouseUp() public méthode

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
Résultat void