Lemmings
Remappable Gestures For Unity
Loading...
Searching...
No Matches
Lemmings.LemmingInter Struct Reference

Represents an integer value with normalized remapping, directional interpolation, and support for flexible out-of-range behavior via Lemmings.LemmingInter.RangeBindingMode. More...

Inherits Lemmings.ILemmingConverter.

Public Types

enum  RangeBindingMode {
  Clamped , CycleUp , CycleDown , Oscillate ,
  None
}
 Specifies how a value behaves outside its [min, max] range. More...

Public Member Functions

 LemmingInter (int raw, int min, int max, RangeBindingMode mode)
 Initializes a new instance of the Lemmings.LemmingInter struct.
void ApplyBounds (RangeBindingMode mode)
 Applies a specified bounding mode to the current value.
int Clamp ()
 Clamps the current value to the [min, max] range.
float ToFloatRange (float outMin, float outMax)
 Remaps the normalized value to a float in a specified output range.
int ToIndex (int arraySize)
 Converts the normalized value to an index within an array.
int ToIntRange (int minimum, int maximum)
 Remaps the normalized value to an integer range.
string ToLabel (string[] labels)
 Maps the current value to a label from a list using normalized indexing.
ToEnum< T > ()
 Maps the current value to a member of the specified enum using normalized indexing.
float ToCurve (AnimationCurve curve)
 Evaluates the normalized value on a Unity AnimationCurve.
Vector3 ToVector (Vector3 vectorA, Vector3 vectorB)
 Interpolates between two vectors using the normalized value.
Quaternion ToQuaternion (Quaternion a, Quaternion b)
 Interpolates between two rotations using the normalized value.
Quaternion ToRotationAroundAxis (Vector3 axis, float minAngle, float maxAngle)
 Remaps the normalized value to a rotation around a specified axis.
Quaternion ToLookRotation (Vector3 from, Vector3 to)
 Creates a look rotation between two vectors based on the normalized value.
override string ToString ()
 Returns a string representation of the current state for debugging purposes.
void SetValue (int newValue)
 Sets a new value and automatically applies the configured binding mode.
void SetRange (int newMin, int newMax)
 Updates the min and max range of the struct.
void SetBindingMode (RangeBindingMode mode)
 Sets a new Lemmings.LemmingInter.RangeBindingMode for how the value should behave when outside the range.
void Reset (int newValue, int newMin, int newMax)
 Resets the value and range all at once, applying the current binding mode.
void ApplyCurrentBinding ()
 Applies the stored bindingMode to the current value. This is a convenience method for using the configured range behavior directly.

Data Fields

int raw
 The current integer value.
int min
 The minimum boundary of the value range.
int max
 The maximum boundary of the value range.
RangeBindingMode bindingMode
 Determines how the value should behave when it exceeds the defined range.

Properties

object Raw [get]
float Normalized [get]
 Returns the current value normalized to a float in [0, 1], based on the configured min and max values.
bool Over [get]
 Returns true if the value is greater than or equal to max.
bool InRange [get]
 Returns true if the value is within the specified range.
bool Under [get]
 Returns true if the value is less than or equal to min.
float AsAxis [get]
 This provides the normalized value in a range of -1 to 1, useful for input mapping and relative values.

Detailed Description

Represents an integer value with normalized remapping, directional interpolation, and support for flexible out-of-range behavior via Lemmings.LemmingInter.RangeBindingMode.

Member Enumeration Documentation

◆ RangeBindingMode

Specifies how a value behaves outside its [min, max] range.

Enumerator
Clamped 

Clamps the value within the min and max bounds.

CycleUp 

Cycles upward from max back to min.

CycleDown 

Cycles downward from min back to max.

Oscillate 

Bounces the value back and forth between min and max.

None 

No bounding is applied; the value is left unmodified.

Constructor & Destructor Documentation

◆ LemmingInter()

Lemmings.LemmingInter.LemmingInter ( int raw,
int min,
int max,
RangeBindingMode mode )
inline

Initializes a new instance of the Lemmings.LemmingInter struct.

Parameters
rawThe initial value.
minMinimum range value.
maxMaximum range value.
modeHow the value should behave when out of range.
Exceptions
ArgumentExceptionThrown if min and max are equal.

Member Function Documentation

◆ ApplyBounds()

void Lemmings.LemmingInter.ApplyBounds ( RangeBindingMode mode)
inline

Applies a specified bounding mode to the current value.

Parameters
modeThe binding mode to apply. Note that Oscillate requires a state to fully function

◆ Clamp()

int Lemmings.LemmingInter.Clamp ( )

Clamps the current value to the [min, max] range.

Returns
The clamped value.

◆ Reset()

void Lemmings.LemmingInter.Reset ( int newValue,
int newMin,
int newMax )
inline

Resets the value and range all at once, applying the current binding mode.

Parameters
newValueNew value.
newMinNew minimum range.
newMaxNew maximum range.
Exceptions
ArgumentExceptionThrown if newMin equals newMax.

◆ SetBindingMode()

void Lemmings.LemmingInter.SetBindingMode ( RangeBindingMode mode)
inline

Sets a new Lemmings.LemmingInter.RangeBindingMode for how the value should behave when outside the range.

Parameters
modeThe new binding mode to apply.

◆ SetRange()

void Lemmings.LemmingInter.SetRange ( int newMin,
int newMax )
inline

Updates the min and max range of the struct.

Parameters
newMinNew minimum value.
newMaxNew maximum value.
Exceptions
ArgumentExceptionThrown if newMin equals newMax.

◆ SetValue()

void Lemmings.LemmingInter.SetValue ( int newValue)
inline

Sets a new value and automatically applies the configured binding mode.

Parameters
newValueThe new value to assign.

◆ ToCurve()

float Lemmings.LemmingInter.ToCurve ( AnimationCurve curve)
inline

Evaluates the normalized value on a Unity AnimationCurve.

Parameters
curveThe curve to evaluate.
Returns
The result of evaluating the curve.

Implements Lemmings.ILemmingConverter.

◆ ToEnum< T >()

T Lemmings.LemmingInter.ToEnum< T > ( )
inline

Maps the current value to a member of the specified enum using normalized indexing.

Template Parameters
TThe enum type to map to.
Returns
A member of the enum.
Type Constraints
T :Enum 

◆ ToFloatRange()

float Lemmings.LemmingInter.ToFloatRange ( float outMin,
float outMax )
inline

Remaps the normalized value to a float in a specified output range.

Parameters
outMinMinimum float output.
outMaxMaximum float output.
Returns
The remapped float.

◆ ToIndex()

int Lemmings.LemmingInter.ToIndex ( int arraySize)
inline

Converts the normalized value to an index within an array.

Parameters
arraySizeThe size of the array.
Returns
An index between 0 and arraySize - 1.

◆ ToIntRange()

int Lemmings.LemmingInter.ToIntRange ( int minimum,
int maximum )
inline

Remaps the normalized value to an integer range.

Parameters
minimumMinimum integer output value.
maximumMaximum integer output value.
Returns
Integer within [minimum , maximum ].

◆ ToLabel()

string Lemmings.LemmingInter.ToLabel ( string[] labels)
inline

Maps the current value to a label from a list using normalized indexing.

Parameters
labelsAn array of string labels.
Returns
A string from the array corresponding to the current value.

◆ ToLookRotation()

Quaternion Lemmings.LemmingInter.ToLookRotation ( Vector3 from,
Vector3 to )
inline

Creates a look rotation between two vectors based on the normalized value.

Parameters
fromStarting direction.
toTarget direction.
Returns
The resulting Quaternion look rotation.

◆ ToQuaternion()

Quaternion Lemmings.LemmingInter.ToQuaternion ( Quaternion a,
Quaternion b )
inline

Interpolates between two rotations using the normalized value.

Parameters
aStart rotation.
bEnd rotation.
Returns
The interpolated Quaternion.

◆ ToRotationAroundAxis()

Quaternion Lemmings.LemmingInter.ToRotationAroundAxis ( Vector3 axis,
float minAngle,
float maxAngle )
inline

Remaps the normalized value to a rotation around a specified axis.

Parameters
axisAxis to rotate around.
minAngleMinimum rotation in degrees.
maxAngleMaximum rotation in degrees.
Returns
The resulting Quaternion.

◆ ToVector()

Vector3 Lemmings.LemmingInter.ToVector ( Vector3 vectorA,
Vector3 vectorB )
inline

Interpolates between two vectors using the normalized value.

Parameters
vectorAStart vector.
vectorBEnd vector.
Returns
The interpolated Vector3.

Property Documentation

◆ AsAxis

float Lemmings.LemmingInter.AsAxis
get

This provides the normalized value in a range of -1 to 1, useful for input mapping and relative values.

Implements Lemmings.ILemmingConverter.

◆ InRange

bool Lemmings.LemmingInter.InRange
get

Returns true if the value is within the specified range.

Implements Lemmings.ILemmingConverter.

◆ Normalized

float Lemmings.LemmingInter.Normalized
get

Returns the current value normalized to a float in [0, 1], based on the configured min and max values.

Implements Lemmings.ILemmingConverter.

◆ Over

bool Lemmings.LemmingInter.Over
get

Returns true if the value is greater than or equal to max.

Implements Lemmings.ILemmingConverter.

◆ Raw

object Lemmings.LemmingInter.Raw
get

◆ Under

bool Lemmings.LemmingInter.Under
get

Returns true if the value is less than or equal to min.

Implements Lemmings.ILemmingConverter.


The documentation for this struct was generated from the following file:
  • Assets/Lemmings/Scripts/Namespace/LemmingConverterStructs.cs