Feel
5.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 { SwitchStates.Off, SwitchStates.On } |
the possible states of the switch More... | |
Public Types inherited from Lofelt.NiceVibrations.MMTouchButton | |
enum | ButtonStates { ButtonStates.Off, ButtonStates.ButtonDown, ButtonStates.ButtonPressed, ButtonStates.ButtonUp, ButtonStates.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 Lofelt.NiceVibrations.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 | |
Image | SwitchKnob |
a SpriteReplace to represent the switch knob More... | |
SwitchStates | InitialState = SwitchStates.Off |
the state the switch should start in More... | |
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 More... | |
UnityEvent | SwitchOff |
the methods to call when the switch is turned off More... | |
Public Attributes inherited from Lofelt.NiceVibrations.MMTouchButton | |
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 |
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 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... | |
override void | Update () |
Every frame, if the touch zone is pressed, we trigger the OnPointerPressed method, to detect continuous press More... | |
Protected Member Functions inherited from Lofelt.NiceVibrations.MMTouchButton | |
virtual void | Awake () |
On Start, we get our canvasgroup and set our initial alpha 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 () |
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 More... | |
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) More... | |
A component to handle switches
|
strong |
|
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