Highroad Engine v1.3
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
MoreMountains.Tools.MMTouchJoystick Class Reference

Joystick input class. In charge of the behaviour of the joystick mobile touch input. Bind its actions from the inspector Handles mouse and multi touch More...

Inheritance diagram for MoreMountains.Tools.MMTouchJoystick:
MoreMountains.Tools.MMTouchDynamicJoystick MoreMountains.Tools.MMTouchRepositionableJoystick

Public Member Functions

virtual void Initialize ()
 
virtual void SetKnobTransform (Transform newTransform)
 Assigns a new transform as the joystick knob More...
 
virtual void SetNeutralPosition ()
 Sets the neutral position of the joystick More...
 
virtual void SetNeutralPosition (Vector3 newPosition)
 
virtual void OnDrag (PointerEventData eventData)
 Handles dragging of the joystick More...
 
virtual void OnEndDrag (PointerEventData eventData)
 What happens when the stick is released More...
 

Public Attributes

Camera TargetCamera
 
float PressedOpacity = 0.5f
 the new opacity to apply to the canvas group when the button is pressed More...
 
bool HorizontalAxisEnabled = true
 Is horizontal axis allowed. More...
 
bool VerticalAxisEnabled = true
 Is vertical axis allowed. More...
 
float MaxRange = 1.5f
 The max range allowed. More...
 
JoystickEvent JoystickValue
 The method(s) to call when the button gets pressed down. More...
 
Transform RotatingIndicator
 an object you can rotate to show the direction of the joystick. Will only be visible if the movement is above a threshold More...
 
float RotatingIndicatorThreshold = 0.1f
 the threshold above which the rotating indicator will appear More...
 
Vector2 _joystickValue
 Current horizontal and vertical values of the joystick (from -1 to 1) More...
 

Protected Member Functions

virtual void Awake ()
 On Start, we get our working canvas, and we set our neutral position More...
 
virtual void Start ()
 
virtual void Update ()
 On Update we check for an orientation change if needed, and send our input values. More...
 
virtual void RotateIndicator ()
 
virtual float EvaluateInputValue (float vectorPosition)
 We compute the axis value from the interval between neutral position, current stick position (vectorPosition) and max range More...
 
virtual void OnEnable ()
 

Protected Attributes

Vector2 _neutralPosition
 Store neutral position of the stick. More...
 
RectTransform _canvasRectTransform
 The canvas rect transform we're working with. More...
 
Vector2 _newTargetPosition
 working vector More...
 
Vector3 _newJoystickPosition
 
float _initialZPosition
 
CanvasGroup _canvasGroup
 
float _initialOpacity
 
Transform _knobTransform
 
bool _rotatingIndicatorIsNotNull = false
 

Properties

RenderMode ParentCanvasRenderMode [getprotected set]
 

Detailed Description

Joystick input class. In charge of the behaviour of the joystick mobile touch input. Bind its actions from the inspector Handles mouse and multi touch

Member Function Documentation

◆ Awake()

virtual void MoreMountains.Tools.MMTouchJoystick.Awake ( )
protectedvirtual

On Start, we get our working canvas, and we set our neutral position

◆ EvaluateInputValue()

virtual float MoreMountains.Tools.MMTouchJoystick.EvaluateInputValue ( float  vectorPosition)
protectedvirtual

We compute the axis value from the interval between neutral position, current stick position (vectorPosition) and max range

Returns
The axis value, a float between -1 and 1
Parameters
vectorPositionstick position.

◆ Initialize()

virtual void MoreMountains.Tools.MMTouchJoystick.Initialize ( )
virtual

◆ OnDrag()

virtual void MoreMountains.Tools.MMTouchJoystick.OnDrag ( PointerEventData  eventData)
virtual

Handles dragging of the joystick

◆ OnEnable()

virtual void MoreMountains.Tools.MMTouchJoystick.OnEnable ( )
protectedvirtual

◆ OnEndDrag()

virtual void MoreMountains.Tools.MMTouchJoystick.OnEndDrag ( PointerEventData  eventData)
virtual

What happens when the stick is released

Reimplemented in MoreMountains.Tools.MMTouchDynamicJoystick, and MoreMountains.Tools.MMTouchRepositionableJoystick.

◆ RotateIndicator()

virtual void MoreMountains.Tools.MMTouchJoystick.RotateIndicator ( )
protectedvirtual

◆ SetKnobTransform()

virtual void MoreMountains.Tools.MMTouchJoystick.SetKnobTransform ( Transform  newTransform)
virtual

Assigns a new transform as the joystick knob

Parameters
newTransform

◆ SetNeutralPosition() [1/2]

virtual void MoreMountains.Tools.MMTouchJoystick.SetNeutralPosition ( )
virtual

Sets the neutral position of the joystick

◆ SetNeutralPosition() [2/2]

virtual void MoreMountains.Tools.MMTouchJoystick.SetNeutralPosition ( Vector3  newPosition)
virtual

◆ Start()

virtual void MoreMountains.Tools.MMTouchJoystick.Start ( )
protectedvirtual

◆ Update()

virtual void MoreMountains.Tools.MMTouchJoystick.Update ( )
protectedvirtual

On Update we check for an orientation change if needed, and send our input values.

Member Data Documentation

◆ _canvasGroup

CanvasGroup MoreMountains.Tools.MMTouchJoystick._canvasGroup
protected

◆ _canvasRectTransform

RectTransform MoreMountains.Tools.MMTouchJoystick._canvasRectTransform
protected

The canvas rect transform we're working with.

◆ _initialOpacity

float MoreMountains.Tools.MMTouchJoystick._initialOpacity
protected

◆ _initialZPosition

float MoreMountains.Tools.MMTouchJoystick._initialZPosition
protected

◆ _joystickValue

Vector2 MoreMountains.Tools.MMTouchJoystick._joystickValue

Current horizontal and vertical values of the joystick (from -1 to 1)

◆ _knobTransform

Transform MoreMountains.Tools.MMTouchJoystick._knobTransform
protected

◆ _neutralPosition

Vector2 MoreMountains.Tools.MMTouchJoystick._neutralPosition
protected

Store neutral position of the stick.

◆ _newJoystickPosition

Vector3 MoreMountains.Tools.MMTouchJoystick._newJoystickPosition
protected

◆ _newTargetPosition

Vector2 MoreMountains.Tools.MMTouchJoystick._newTargetPosition
protected

working vector

◆ _rotatingIndicatorIsNotNull

bool MoreMountains.Tools.MMTouchJoystick._rotatingIndicatorIsNotNull = false
protected

◆ HorizontalAxisEnabled

bool MoreMountains.Tools.MMTouchJoystick.HorizontalAxisEnabled = true

Is horizontal axis allowed.

◆ JoystickValue

JoystickEvent MoreMountains.Tools.MMTouchJoystick.JoystickValue

The method(s) to call when the button gets pressed down.

◆ MaxRange

float MoreMountains.Tools.MMTouchJoystick.MaxRange = 1.5f

The max range allowed.

◆ PressedOpacity

float MoreMountains.Tools.MMTouchJoystick.PressedOpacity = 0.5f

the new opacity to apply to the canvas group when the button is pressed

◆ RotatingIndicator

Transform MoreMountains.Tools.MMTouchJoystick.RotatingIndicator

an object you can rotate to show the direction of the joystick. Will only be visible if the movement is above a threshold

◆ RotatingIndicatorThreshold

float MoreMountains.Tools.MMTouchJoystick.RotatingIndicatorThreshold = 0.1f

the threshold above which the rotating indicator will appear

◆ TargetCamera

Camera MoreMountains.Tools.MMTouchJoystick.TargetCamera

◆ VerticalAxisEnabled

bool MoreMountains.Tools.MMTouchJoystick.VerticalAxisEnabled = true

Is vertical axis allowed.

Property Documentation

◆ ParentCanvasRenderMode

RenderMode MoreMountains.Tools.MMTouchJoystick.ParentCanvasRenderMode
getprotected set

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