Class UIAudioHandler<T>
- Namespace
- Fallencake.UI.Audio
- Assembly
- Fallencake.UI.dll
Generic base class for UI audio handlers that wires UI events to sound playback and provides shared management via AudioManager.
public class UIAudioHandler<T> : IAudioHandler, IAudioEventHandler where T : IAudioProvider
Type Parameters
T
- Inheritance
-
objectUIAudioHandler<T>
- Implements
- Derived
Constructors
UIAudioHandler(T)
public UIAudioHandler(T provider)
Parameters
providerT
Properties
AudioSource
Audio source for playing sounds.
public AudioSource AudioSource { get; set; }
Property Value
- AudioSource
Component
Component used for coroutines and context.
public MonoBehaviour Component { get; }
Property Value
- MonoBehaviour
EnableSounds
Whether sounds are enabled for the component.
public bool EnableSounds { get; set; }
Property Value
- bool
Selectable
Associated selectable used to attach event triggers.
public Selectable Selectable { get; }
Property Value
- Selectable
Volume
Volume for sound playback.
public float Volume { get; set; }
Property Value
- float
_provider
protected T _provider { get; }
Property Value
- T
Methods
AddEventTriggers()
Adds event handlers to the component.
protected virtual void AddEventTriggers()
Dispose()
Releases resources and unregisters from the manager.
public virtual void Dispose()
IsInteractable()
Checks if the component is available for interaction.
protected virtual bool IsInteractable()
Returns
- bool
OnDeselect(BaseEventData)
Called when the element is deselected.
public virtual void OnDeselect(BaseEventData eventData)
Parameters
eventDataBaseEventData
OnPointerClick(PointerEventData)
Called when the element is clicked.
public virtual void OnPointerClick(PointerEventData eventData)
Parameters
eventDataPointerEventData
OnPointerEnter(PointerEventData)
Called when the pointer enters the element.
public virtual void OnPointerEnter(PointerEventData eventData)
Parameters
eventDataPointerEventData
OnPointerExit(PointerEventData)
Called when the pointer exits the element.
public virtual void OnPointerExit(PointerEventData eventData)
Parameters
eventDataPointerEventData
OnSelect(BaseEventData)
Called when the element is selected.
public virtual void OnSelect(BaseEventData eventData)
Parameters
eventDataBaseEventData
OnSubmit(BaseEventData)
Called when the element is submitted.
public virtual void OnSubmit(BaseEventData eventData)
Parameters
eventDataBaseEventData
PlayDeselectSound()
Plays the deselect sound.
public virtual void PlayDeselectSound()
PlayPressSound()
Plays the press sound.
public virtual void PlayPressSound()
PlaySelectSound()
Plays the select sound.
public virtual void PlaySelectSound()
RemoveEventTriggers()
Removes event handlers from the component.
protected virtual void RemoveEventTriggers()
UpdateInteractable(bool)
Updates the interactable state and event handlers.
public virtual void UpdateInteractable(bool isInteractable)
Parameters
isInteractableboolNew interactable state.