MeatMotion

R3MotionExtensions

Expose tween values from a builder as an R3 Observable, bind values to a ReactiveProperty or register disposal.

Namespace
MeatMotion
Assembly
MeatMotion.Integrations.R3

Jump to members

public static class R3MotionExtensions

Requires org.nuget.r3 / com.cysharp.r3

R3MotionExtensions.cs · L6

Members

ToObservable

Bind the builder and expose its values as a stream. Both motion completion and cancellation finish the stream.

public static Observable<float> ToObservable(this FloatMotionBuilder builder)
Parameters and return value
builder
this FloatMotionBuilder Configured builder, passed as the receiver for extension calls.
Returns
Observable<float>
public static Observable<TValue> ToObservable<TValue, TOptions, TAdapter>(this MotionBuilder<TValue, TOptions, TAdapter> builder)
    where TValue : unmanaged
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<TValue, TOptions>
Parameters and return value
builder
this MotionBuilder<TValue, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
Returns
Observable<TValue>

BindToReactiveProperty

Write each interpolated value into the supplied ReactiveProperty.

public static MotionHandle BindToReactiveProperty(this FloatMotionBuilder builder, ReactiveProperty<float> reactiveProperty)
Parameters and return value
builder
this FloatMotionBuilder Configured builder, passed as the receiver for extension calls.
reactiveProperty
ReactiveProperty<float> Reactive property that receives each sampled value.
Returns
MotionHandle
public static MotionHandle BindToReactiveProperty<TValue, TOptions, TAdapter>(this MotionBuilder<TValue, TOptions, TAdapter> builder, ReactiveProperty<TValue> reactiveProperty)
    where TValue : unmanaged
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<TValue, TOptions>
Parameters and return value
builder
this MotionBuilder<TValue, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
reactiveProperty
ReactiveProperty<TValue> Reactive property that receives each sampled value.
Returns
MotionHandle

AddTo

Register the handle in an R3 disposable container and apply disposeBehavior on disposal.

public static MotionHandle AddTo(this MotionHandle handle, CompositeDisposable disposable, DisposeBehavior disposeBehavior = DisposeBehavior.Cancel)
Parameters and return value
handle
this MotionHandle Handle to control or link.
disposable
CompositeDisposable R3 container that owns disposal of the handle.
disposeBehavior = DisposeBehavior.Cancel
DisposeBehavior Action to apply when the registered IDisposable is disposed.
Returns
MotionHandle
public static MotionHandle AddTo(this MotionHandle handle, SerialDisposable disposable, DisposeBehavior disposeBehavior = DisposeBehavior.Cancel)
Parameters and return value
handle
this MotionHandle Handle to control or link.
disposable
SerialDisposable R3 container that owns disposal of the handle.
disposeBehavior = DisposeBehavior.Cancel
DisposeBehavior Action to apply when the registered IDisposable is disposed.
Returns
MotionHandle
public static MotionHandle AddTo(this MotionHandle handle, ref DisposableBag disposable, DisposeBehavior disposeBehavior = DisposeBehavior.Cancel)
Parameters and return value
handle
this MotionHandle Handle to control or link.
disposable
ref DisposableBag R3 container that owns disposal of the handle.
disposeBehavior = DisposeBehavior.Cancel
DisposeBehavior Action to apply when the registered IDisposable is disposed.
Returns
MotionHandle
public static MotionHandle AddTo(this MotionHandle handle, ref DisposableBuilder disposable, DisposeBehavior disposeBehavior = DisposeBehavior.Cancel)
Parameters and return value
handle
this MotionHandle Handle to control or link.
disposable
ref DisposableBuilder R3 container that owns disposal of the handle.
disposeBehavior = DisposeBehavior.Cancel
DisposeBehavior Action to apply when the registered IDisposable is disposed.
Returns
MotionHandle