Tanks Multiplayer  1.5
Public Member Functions | Public Attributes | Events | List of all members
UIJoystick

Joystick component for controlling player movement and actions using Unity UI events. There can be multiple joysticks on the screen at the same time, implementing different callbacks. More...

Inheritance diagram for UIJoystick:

Public Member Functions

void OnBeginDrag (PointerEventData data)
 Event fired by UI Eventsystem on drag start. More...
 
void OnDrag (PointerEventData data)
 Event fired by UI Eventsystem on drag. More...
 
void OnEndDrag (PointerEventData data)
 Event fired by UI Eventsystem on drag end. More...
 

Public Attributes

Transform target
 The target object i.e. jostick thumb being dragged by the user. More...
 
float radius = 50f
 Maximum radius for the target object to be moved in distance from the center. More...
 
Vector2 position
 Current position of the target object on the x and y axis in 2D space. Values are calculated in the range of [-1, 1] translated to left/down right/up. More...
 

Events

Action onDragBegin
 Callback triggered when joystick starts moving by user input. More...
 
Action< Vector2 > onDrag
 Callback triggered when joystick is moving or hold down. More...
 
Action onDragEnd
 Callback triggered when joystick input is being released. More...
 

Detailed Description

Joystick component for controlling player movement and actions using Unity UI events. There can be multiple joysticks on the screen at the same time, implementing different callbacks.

Member Function Documentation

void OnBeginDrag ( PointerEventData  data)

Event fired by UI Eventsystem on drag start.

void OnDrag ( PointerEventData  data)

Event fired by UI Eventsystem on drag.

void OnEndDrag ( PointerEventData  data)

Event fired by UI Eventsystem on drag end.

Member Data Documentation

Vector2 position

Current position of the target object on the x and y axis in 2D space. Values are calculated in the range of [-1, 1] translated to left/down right/up.

float radius = 50f

Maximum radius for the target object to be moved in distance from the center.

Transform target

The target object i.e. jostick thumb being dragged by the user.

Event Documentation

Action<Vector2> onDrag

Callback triggered when joystick is moving or hold down.

Action onDragBegin

Callback triggered when joystick starts moving by user input.

Action onDragEnd

Callback triggered when joystick input is being released.


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