Feel  3.16
The best way to improve your game's feel and make it extra juicy
MoreMountains.Tools.MMTouchAxis Class Reference

Add this component to a GUI Image to have it act as an axis. Bind pressed down, pressed continually and released actions to it from the inspector Handles mouse and multi touch More...

Inheritance diagram for MoreMountains.Tools.MMTouchAxis:

Public Types

enum  ButtonStates { ButtonStates.Off, ButtonStates.ButtonDown, ButtonStates.ButtonPressed, ButtonStates.ButtonUp }
 

Public Member Functions

virtual void OnPointerDown (PointerEventData data)
 Triggers the bound pointer down action More...
 
virtual void OnPointerUp (PointerEventData data)
 Triggers the bound pointer up action More...
 
virtual void OnPointerEnter (PointerEventData data)
 Triggers the bound pointer enter action when touch enters zone More...
 
virtual void OnPointerExit (PointerEventData data)
 Triggers the bound pointer exit action when touch is out of zone More...
 

Public Attributes

UnityEvent AxisPressedFirstTime
 The method(s) to call when the axis gets pressed down. More...
 
UnityEvent AxisReleased
 The method(s) to call when the axis gets released. More...
 
AxisEvent AxisPressed
 The method(s) to call while the axis is being pressed. More...
 
float PressedOpacity = 0.5f
 the new opacity to apply to the canvas group when the axis is pressed More...
 
float AxisValue
 the value to send the bound method when the axis is pressed More...
 
bool MouseMode = false
 If you set this to true, you'll need to actually press the axis for it to be triggered, otherwise a simple hover will trigger it (better for touch input). More...
 

Protected Member Functions

virtual void Awake ()
 On Start, we get our canvasgroup and set our initial alpha More...
 
virtual void Update ()
 Every frame, if the touch zone is pressed, we trigger the bound method if it exists More...
 
virtual void LateUpdate ()
 At the end of every frame, we change our button's state if needed More...
 
virtual void OnEnable ()
 OnEnable, we reset our button state More...
 
virtual void ResetButton ()
 Resets the button's state and opacity More...
 

Protected Attributes

CanvasGroup _canvasGroup
 
float _initialOpacity
 

Properties

virtual ButtonStates CurrentState [get, protected set]
 

Detailed Description

Add this component to a GUI Image to have it act as an axis. Bind pressed down, pressed continually and released actions to it from the inspector Handles mouse and multi touch

Member Enumeration Documentation

◆ ButtonStates

Enumerator
Off 
ButtonDown 
ButtonPressed 
ButtonUp 

Member Function Documentation

◆ Awake()

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

On Start, we get our canvasgroup and set our initial alpha

◆ LateUpdate()

virtual void MoreMountains.Tools.MMTouchAxis.LateUpdate ( )
protectedvirtual

At the end of every frame, we change our button's state if needed

◆ OnEnable()

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

OnEnable, we reset our button state

◆ OnPointerDown()

virtual void MoreMountains.Tools.MMTouchAxis.OnPointerDown ( PointerEventData  data)
virtual

Triggers the bound pointer down action

◆ OnPointerEnter()

virtual void MoreMountains.Tools.MMTouchAxis.OnPointerEnter ( PointerEventData  data)
virtual

Triggers the bound pointer enter action when touch enters zone

◆ OnPointerExit()

virtual void MoreMountains.Tools.MMTouchAxis.OnPointerExit ( PointerEventData  data)
virtual

Triggers the bound pointer exit action when touch is out of zone

◆ OnPointerUp()

virtual void MoreMountains.Tools.MMTouchAxis.OnPointerUp ( PointerEventData  data)
virtual

Triggers the bound pointer up action

◆ ResetButton()

virtual void MoreMountains.Tools.MMTouchAxis.ResetButton ( )
protectedvirtual

Resets the button's state and opacity

◆ Update()

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

Every frame, if the touch zone is pressed, we trigger the bound method if it exists

Member Data Documentation

◆ _canvasGroup

CanvasGroup MoreMountains.Tools.MMTouchAxis._canvasGroup
protected

◆ _initialOpacity

float MoreMountains.Tools.MMTouchAxis._initialOpacity
protected

◆ AxisPressed

AxisEvent MoreMountains.Tools.MMTouchAxis.AxisPressed

The method(s) to call while the axis is being pressed.

◆ AxisPressedFirstTime

UnityEvent MoreMountains.Tools.MMTouchAxis.AxisPressedFirstTime

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

◆ AxisReleased

UnityEvent MoreMountains.Tools.MMTouchAxis.AxisReleased

The method(s) to call when the axis gets released.

◆ AxisValue

float MoreMountains.Tools.MMTouchAxis.AxisValue

the value to send the bound method when the axis is pressed

◆ MouseMode

bool MoreMountains.Tools.MMTouchAxis.MouseMode = false

If you set this to true, you'll need to actually press the axis for it to be triggered, otherwise a simple hover will trigger it (better for touch input).

◆ PressedOpacity

float MoreMountains.Tools.MMTouchAxis.PressedOpacity = 0.5f

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

Property Documentation

◆ CurrentState

virtual ButtonStates MoreMountains.Tools.MMTouchAxis.CurrentState
getprotected set

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