Class UnityFeedbackService
Unity MonoBehaviour implementation of IFeedbackService and IFeedbackRuntime.
Routes each effect of a definition to every channel that can play it, and owns the single global
stop/lifecycle safety net (application focus/pause, scene unload, play-mode exit, disable/destroy,
and the vibration-disabled setting). Per-effect timing/restoration is owned by each channel via the
coroutine host this class exposes through IFeedbackRuntime.
Inheritance
UnityFeedbackService
Assembly: Serenity.UnityFeedback.Infrastructure.dll
Syntax
public class UnityFeedbackService : MonoBehaviour, IFeedbackService, IService, IFoundationSettings, IFeedbackRuntime
Constructors
UnityFeedbackService()
Declaration
public UnityFeedbackService()
Fields
Guid
Declaration
Field Value
| Type |
Description |
| string |
GUID for this service instance.
|
Id
Declaration
Field Value
| Type |
Description |
| string |
Unique identifier for this service instance.
|
_channels
Declaration
protected List<IFeedbackChannel> _channels
Field Value
_definitionProvider
Declaration
protected IFeedbackDefinitionProvider _definitionProvider
Field Value
_eventDispatcherService
Declaration
protected IEventDispatcherService _eventDispatcherService
Field Value
_gameSettingsService
Declaration
protected IGameSettingsService _gameSettingsService
Field Value
_globalEnabled
Declaration
protected bool _globalEnabled
Field Value
_globalIntensity
Declaration
protected float _globalIntensity
Field Value
_logService
Declaration
protected ILogService _logService
Field Value
Declaration
protected string _menuSubmitDefinitionId
Field Value
Declaration
protected string _menuTickDefinitionId
Field Value
_resolver
Declaration
protected UnityGamepadTargetResolver _resolver
Field Value
_runtimeCoroutines
Declaration
protected readonly Dictionary<object, Coroutine> _runtimeCoroutines
Field Value
_vibrationEnabledSettingId
Declaration
protected string _vibrationEnabledSettingId
Field Value
_vibrationIntensitySettingId
Declaration
protected string _vibrationIntensitySettingId
Field Value
Properties
IsEnabled
Declaration
public bool IsEnabled { get; }
Property Value
LogService
Declaration
public ILogService LogService { get; set; }
Property Value
Declaration
public string MenuSubmitDefinitionId { get; }
Property Value
Declaration
public string MenuTickDefinitionId { get; }
Property Value
Methods
Cancel(object)
Declaration
public virtual void Cancel(object handle)
Parameters
| Type |
Name |
Description |
| object |
handle |
|
Initialize(IGameSettingsService, IFeedbackSettings, IFeedbackDefinitionProvider, List<IFeedbackChannel>, IEventDispatcherService, ILogService)
Initializes the service with all required dependencies. Called by the installer after the
service exists and the channels (which take this instance as their IFeedbackRuntime)
have been constructed.
Declaration
public void Initialize(IGameSettingsService gameSettingsService, IFeedbackSettings settings, IFeedbackDefinitionProvider definitionProvider, List<IFeedbackChannel> channels, IEventDispatcherService eventDispatcherService, ILogService logService)
Parameters
Play(FeedbackDefinitionData)
Declaration
public virtual void Play(FeedbackDefinitionData definition)
Parameters
Play(string)
Declaration
public virtual void Play(string definitionId)
Parameters
| Type |
Name |
Description |
| string |
definitionId |
|
PlayForDevice(string, FeedbackDefinitionData)
Declaration
public virtual void PlayForDevice(string deviceId, FeedbackDefinitionData definition)
Parameters
PlayForDevice(string, string)
Declaration
public virtual void PlayForDevice(string deviceId, string definitionId)
Parameters
PlayForPlayer(int, FeedbackDefinitionData)
Declaration
public virtual void PlayForPlayer(int playerIndex, FeedbackDefinitionData definition)
Parameters
PlayForPlayer(int, string)
Declaration
public virtual void PlayForPlayer(int playerIndex, string definitionId)
Parameters
| Type |
Name |
Description |
| int |
playerIndex |
|
| string |
definitionId |
|
Declaration
public virtual void PlayForPlayerInput(object playerInput, FeedbackDefinitionData definition)
Parameters
Declaration
public virtual void PlayForPlayerInput(object playerInput, string definitionId)
Parameters
| Type |
Name |
Description |
| object |
playerInput |
|
| string |
definitionId |
|
Run(IEnumerator, object)
Declaration
public virtual void Run(IEnumerator routine, object handle)
Parameters
SetGlobalEnabled(bool)
Declaration
public virtual void SetGlobalEnabled(bool enabled)
Parameters
| Type |
Name |
Description |
| bool |
enabled |
|
SetGlobalIntensity(float)
Declaration
public virtual void SetGlobalIntensity(float intensity01)
Parameters
| Type |
Name |
Description |
| float |
intensity01 |
|
StopAll()
Declaration
public virtual void StopAll()
Implements