Class FeedbackPatternPlayer
Walks an IFeedbackPattern's FeedbackPatternStep sequence in real time:
waits until each step's StartOffsetSeconds, invokes
onStepStart with the step, holds for the step's on-time
(step.Intensity.Duration), then invokes onStepEnd. When looping, also waits out the
remainder of TotalDurationSeconds after the last step ends before
restarting, so a trailing off-gap (e.g. the duty-cycle off-time of a single-step pulse) survives the
loop boundary instead of being skipped. Uses UnityEngine.WaitForSecondsRealtime to match
VibrationChannel's existing timed-auto-stop convention (realtime, so a paused game still stops
the buzz). Intended to run as a IFeedbackRuntime
routine — cancelling it is just cancelling that routine's handle, no separate stop API needed.
Inherited Members
Namespace: Serenity.Feedback.Infrastructure.Channels
Assembly: Serenity.UnityFeedback.Infrastructure.dll
Syntax
public static class FeedbackPatternPlayer
Methods
Play(IFeedbackPattern, bool, Action<FeedbackPatternStep>, Action)
Builds the coroutine that walks pattern's steps once, or forever when
loop is true (waiting out the pattern's remaining
TotalDurationSeconds after the last step, then looping back to the
start of the sequence).
Declaration
public static IEnumerator Play(IFeedbackPattern pattern, bool loop, Action<FeedbackPatternStep> onStepStart, Action onStepEnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IFeedbackPattern | pattern | The pattern to walk. A null/empty step list yields immediately (a no-op). |
| bool | loop | When true, replays the whole sequence — including its trailing gap — back-to-back indefinitely. |
| Action<FeedbackPatternStep> | onStepStart | Invoked with each step as it begins (e.g. set motor speeds). |
| Action | onStepEnd | Invoked once a step's on-time elapses (e.g. zero the motors). |
Returns
| Type | Description |
|---|---|
| IEnumerator |