![]() |
Feel 5.9.1
The best way to improve your game's feel and make it extra juicy
|
A component to handle switches. More...
Public Types | |
| enum | SwitchStates { Off , On } |
| the possible states of the switch More... | |
| Public Types inherited from Lofelt.NiceVibrations.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. | |
| Public Member Functions inherited from Lofelt.NiceVibrations.MMTouchButton | |
| virtual void | OnPointerDown (PointerEventData data) |
| Triggers the bound pointer down action. | |
| virtual void | OnPointerUp (PointerEventData data) |
| Triggers the bound pointer up action. | |
| virtual void | OnPointerPressed () |
| Triggers the bound pointer pressed action. | |
| virtual void | OnPointerEnter (PointerEventData data) |
| Triggers the bound pointer enter action when touch enters zone. | |
| virtual void | OnPointerExit (PointerEventData data) |
| Triggers the bound pointer exit action when touch is out of zone. | |
| virtual void | DisableButton () |
| virtual void | EnableButton () |
| virtual void | OnSubmit (BaseEventData eventData) |
Public Attributes | |
| Image | SwitchKnob |
| a SpriteReplace to represent the switch knob | |
| SwitchStates | InitialState = SwitchStates.Off |
| the state the switch should start in | |
| Transform | OffPosition |
| Transform | OnPosition |
| AnimationCurve | KnobMovementCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f) |
| float | KnobMovementDuration = 0.2f |
| UnityEvent | SwitchOn |
| the methods to call when the switch is turned on | |
| UnityEvent | SwitchOff |
| the methods to call when the switch is turned off | |
| Public Attributes inherited from Lofelt.NiceVibrations.MMTouchButton | |
| UnityEvent | ButtonPressedFirstTime |
| The method(s) to call when the button gets pressed down. | |
| UnityEvent | ButtonReleased |
| The method(s) to call when the button gets released. | |
| UnityEvent | ButtonPressed |
| The method(s) to call while the button is being pressed. | |
| Sprite | DisabledSprite |
| Sprite | PressedSprite |
| Sprite | HighlightedSprite |
| bool | PressedChangeColor = false |
| Color | PressedColor = Color.white |
| bool | LerpColor = true |
| float | LerpColorDuration = 0.2f |
| AnimationCurve | LerpColorCurve |
| float | PressedOpacity = 1f |
| the new opacity to apply to the canvas group when the button is pressed | |
| 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). | |
Protected Member Functions | |
| override void | Initialization () |
| On init, we set our current switch state. | |
| override void | Update () |
| Every frame, if the touch zone is pressed, we trigger the OnPointerPressed method, to detect continuous press. | |
| Protected Member Functions inherited from Lofelt.NiceVibrations.MMTouchButton | |
| virtual void | Awake () |
| On Start, we get our canvasgroup and set our initial alpha. | |
| virtual void | LateUpdate () |
| At the end of every frame, we change our button's state if needed. | |
| virtual void | InvokePressedFirstTime () |
| virtual void | InvokeReleased () |
| virtual void | ResetButton () |
| Resets the button's state and opacity. | |
| virtual void | OnEnable () |
| OnEnable, we reset our button state. | |
| virtual void | SetOpacity (float newOpacity) |
| virtual void | UpdateAnimatorStates () |
| virtual float | Remap (float x, float A, float B, float C, float D) |
Protected Attributes | |
| float | _knobMovementStartedAt = -50f |
| Protected Attributes inherited from Lofelt.NiceVibrations.MMTouchButton | |
| bool | _zonePressed = false |
| CanvasGroup | _canvasGroup |
| float | _initialOpacity |
| Animator | _animator |
| Image | _image |
| Sprite | _initialSprite |
| Color | _initialColor |
| float | _lastClickTimestamp = 0f |
| Selectable | _selectable |
| float | _lastStateChangeAt = -50f |
| Color | _imageColor |
| Color | _fromColor |
| Color | _toColor |
Properties | |
| SwitchStates | CurrentSwitchState [get, set] |
| the current state of the switch | |
| Properties inherited from Lofelt.NiceVibrations.MMTouchButton | |
| bool | ReturnToInitialSpriteAutomatically [get, set] |
| ButtonStates | CurrentState [get, protected set] |
| the current state of the button (off, down, pressed or up) | |
A component to handle switches.
|
protectedvirtual |
On init, we set our current switch state.
Reimplemented from Lofelt.NiceVibrations.MMTouchButton.
|
virtual |
|
virtual |
Use this method to go from one state to the other.
|
protectedvirtual |
Every frame, if the touch zone is pressed, we trigger the OnPointerPressed method, to detect continuous press.
Reimplemented from Lofelt.NiceVibrations.MMTouchButton.
|
protected |
| SwitchStates Lofelt.NiceVibrations.MMSwitch.InitialState = SwitchStates.Off |
the state the switch should start in
| AnimationCurve Lofelt.NiceVibrations.MMSwitch.KnobMovementCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f) |
| float Lofelt.NiceVibrations.MMSwitch.KnobMovementDuration = 0.2f |
| Transform Lofelt.NiceVibrations.MMSwitch.OffPosition |
| Transform Lofelt.NiceVibrations.MMSwitch.OnPosition |
| Image Lofelt.NiceVibrations.MMSwitch.SwitchKnob |
a SpriteReplace to represent the switch knob
| UnityEvent Lofelt.NiceVibrations.MMSwitch.SwitchOff |
the methods to call when the switch is turned off
| UnityEvent Lofelt.NiceVibrations.MMSwitch.SwitchOn |
the methods to call when the switch is turned on
|
getset |
the current state of the switch