Infinite Runner Engine v1.9
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
MoreMountains.MMInterface.MMSwitch Class Reference

A component to handle switches More...

Inheritance diagram for MoreMountains.MMInterface.MMSwitch:
MoreMountains.Tools.MMTouchButton

Public Types

enum  SwitchStates { Left , Right }
 the possible states of the switch More...
 
- Public Types inherited from MoreMountains.Tools.MMTouchButton
enum  ButtonStates {
  Off , ButtonDown , ButtonPressed , ButtonUp ,
  Disabled
}
 

Public Member Functions

virtual void InitializeState ()
 
virtual void SwitchState ()
 Use this method to go from one state to the other More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMTouchButton
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 OnPointerPressed ()
 Triggers the bound pointer pressed 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...
 
virtual void DisableButton ()
 
virtual void EnableButton ()
 
virtual void OnSubmit (BaseEventData eventData)
 

Public Attributes

MMSpriteReplace SwitchKnob
 a SpriteReplace to represent the switch knob More...
 
SwitchStates InitialState = SwitchStates.Left
 the state the switch should start in More...
 
UnityEvent SwitchOn
 the methods to call when the switch is turned on More...
 
UnityEvent SwitchOff
 the methods to call when the switch is turned off More...
 
- Public Attributes inherited from MoreMountains.Tools.MMTouchButton
bool Interactable = true
 whether or not this button can be interacted with More...
 
UnityEvent ButtonPressedFirstTime
 The method(s) to call when the button gets pressed down. More...
 
UnityEvent ButtonReleased
 The method(s) to call when the button gets released. More...
 
UnityEvent ButtonPressed
 The method(s) to call while the button is being pressed. More...
 
Sprite DisabledSprite
 
bool DisabledChangeColor = false
 
Color DisabledColor = Color.white
 
Sprite PressedSprite
 
bool PressedChangeColor = false
 
Color PressedColor = Color.white
 
Sprite HighlightedSprite
 
bool HighlightedChangeColor = false
 
Color HighlightedColor = Color.white
 
float PressedOpacity = 1f
 the new opacity to apply to the canvas group when the button is pressed More...
 
float IdleOpacity = 1f
 
float DisabledOpacity = 1f
 
float PressedFirstTimeDelay = 0f
 
float ReleasedDelay = 0f
 
float BufferDuration = 0f
 
Animator Animator
 
string IdleAnimationParameterName = "Idle"
 
string DisabledAnimationParameterName = "Disabled"
 
string PressedAnimationParameterName = "Pressed"
 
bool MouseMode = false
 If you set this to true, you'll need to actually press the button for it to be triggered, otherwise a simple hover will trigger it (better for touch input). More...
 

Protected Member Functions

override void Initialization ()
 On init, we set our current switch state More...
 
- Protected Member Functions inherited from MoreMountains.Tools.MMTouchButton
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 OnPointerPressed method, to detect continuous press More...
 
virtual void LateUpdate ()
 At the end of every frame, we change our button's state if needed More...
 
virtual void InvokePressedFirstTime ()
 
virtual void InvokeReleased ()
 
virtual void ResetButton ()
 Resets the button's state and opacity More...
 
virtual void OnEnable ()
 OnEnable, we reset our button state More...
 
virtual void SetOpacity (float newOpacity)
 
virtual void UpdateAnimatorStates ()
 

Properties

SwitchStates CurrentSwitchState [getset]
 the current state of the switch More...
 
- Properties inherited from MoreMountains.Tools.MMTouchButton
bool ReturnToInitialSpriteAutomatically [getset]
 
ButtonStates CurrentState [getprotected set]
 the current state of the button (off, down, pressed or up) More...
 

Additional Inherited Members

- Protected Attributes inherited from MoreMountains.Tools.MMTouchButton
bool _zonePressed = false
 
CanvasGroup _canvasGroup
 
float _initialOpacity
 
Animator _animator
 
Image _image
 
Sprite _initialSprite
 
Color _initialColor
 
float _lastClickTimestamp = 0f
 
Selectable _selectable
 
- Events inherited from MoreMountains.Tools.MMTouchButton
System.Action< PointerEventData.FramePressState, PointerEventData > ButtonStateChange
 

Detailed Description

A component to handle switches

Member Enumeration Documentation

◆ SwitchStates

the possible states of the switch

Enumerator
Left 
Right 

Member Function Documentation

◆ Initialization()

override void MoreMountains.MMInterface.MMSwitch.Initialization ( )
protectedvirtual

On init, we set our current switch state

Reimplemented from MoreMountains.Tools.MMTouchButton.

◆ InitializeState()

virtual void MoreMountains.MMInterface.MMSwitch.InitializeState ( )
virtual

◆ SwitchState()

virtual void MoreMountains.MMInterface.MMSwitch.SwitchState ( )
virtual

Use this method to go from one state to the other

Member Data Documentation

◆ InitialState

SwitchStates MoreMountains.MMInterface.MMSwitch.InitialState = SwitchStates.Left

the state the switch should start in

◆ SwitchKnob

MMSpriteReplace MoreMountains.MMInterface.MMSwitch.SwitchKnob

a SpriteReplace to represent the switch knob

◆ SwitchOff

UnityEvent MoreMountains.MMInterface.MMSwitch.SwitchOff

the methods to call when the switch is turned off

◆ SwitchOn

UnityEvent MoreMountains.MMInterface.MMSwitch.SwitchOn

the methods to call when the switch is turned on

Property Documentation

◆ CurrentSwitchState

SwitchStates MoreMountains.MMInterface.MMSwitch.CurrentSwitchState
getset

the current state of the switch


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