MotionBuilderExtensions.cs
Runtime/Builders/MotionBuilderExtensions.cs
1 using System;
2
3 namespace MeatMotion
4 {
5 public static partial class MotionBuilderExtensions
6 {
7 public static MotionHandle Bind<TState>(this FloatMotionBuilder builder, TState state, Action<float, TState> action)
8 where TState : struct
9 => builder.AsMotionBuilder().BindValueState(state, action);
10
11 public static MotionHandle Bind<TValue, TOptions, TAdapter, TState>(
12 this MotionBuilder<TValue, TOptions, TAdapter> builder, TState state, Action<TValue, TState> action)
13 where TValue : unmanaged
14 where TOptions : unmanaged, IMotionOptions
15 where TAdapter : unmanaged, IMotionAdapter<TValue, TOptions>
16 where TState : struct
17 => builder.BindValueState(state, action);
18
19 public static MotionBuilder<TValue, IntegerOptions, TAdapter> WithRoundingMode<TValue, TAdapter>(
20 this MotionBuilder<TValue, IntegerOptions, TAdapter> builder, RoundingMode roundingMode)
21 where TValue : unmanaged
22 where TAdapter : unmanaged, IMotionAdapter<TValue, IntegerOptions>
23 => builder.WithOptions(new IntegerOptions { RoundingMode = roundingMode });
24 }
25 }