Method Select
- Namespace
- Gamelogic.Extensions.Algorithms
- Assembly
- Gamelogic.Extensions.dll
Select<TSource, TResult>(IResponseCurve<TSource>, Func<TSource, TResult>)
Creates a response curve that transforms the output of the given curve using the given function.
[Version(3, 2, 0)]
public static IResponseCurve<TResult> Select<TSource, TResult>(this IResponseCurve<TSource> source, Func<TSource, TResult> selector)
Parameters
source
IResponseCurve<TSource>The source curve.
selector
Func<TSource, TResult>The selector used to transform results from the source curve.
Returns
- IResponseCurve<TResult>
IResponseCurve<TResult>.
Type Parameters
TSource
The type of the source response curve.
TResult
The type of the result response curve.
Examples
The following makes a response curve that returns string representation of the results of a float response curve:
float[] input = { 0f, 0.5f, 1f };
float[] output = { 0f, 1f, 10f };
var curve = new ResponseCurveFloat(input, output).Select(x => x.ToString());
uiComponent.text = curve[0.75f];