JUtils
A unity utilities library
JUtils.MinMax Struct Reference

A struct with a custom editor which can be used to get a minimum and a maximum value, handy for random values & clamping More...

Public Member Functions

 MinMax (float min, float max)
 Create a new MinMax instance More...
 
float Random ()
 Get a random value from min to max using UnityEngine.Random More...
 
float Random (Random random)
 Get a random value from min to max using System.Random More...
 
bool Contains (float value)
 Check if the value is contained between min and max More...
 
float Clamp (float value)
 Clamps the value to be between A and B More...
 
float Lerp (float time)
 Lerp from min to max More...
 
float InverseLerp (float value)
 inverse lerp from min to max More...
 

Properties

float min [get]
 Get the min value More...
 
float max [get]
 Get the max value More...
 
float range [get]
 Returns _max - _min More...
 

Detailed Description

A struct with a custom editor which can be used to get a minimum and a maximum value, handy for random values & clamping

Constructor & Destructor Documentation

◆ MinMax()

JUtils.MinMax.MinMax ( float  min,
float  max 
)
inline

Create a new MinMax instance

Parameters
min
max

References JUtils.MinMax.max, and JUtils.MinMax.min.

Member Function Documentation

◆ Clamp()

float JUtils.MinMax.Clamp ( float  value)
inline

Clamps the value to be between A and B

Parameters
value
Returns

References JUtils.MinMax.max, and JUtils.MinMax.min.

◆ Contains()

bool JUtils.MinMax.Contains ( float  value)
inline

Check if the value is contained between min and max

References JUtils.MinMax.max, and JUtils.MinMax.min.

◆ InverseLerp()

float JUtils.MinMax.InverseLerp ( float  value)
inline

inverse lerp from min to max

References JUtils.MinMax.max, and JUtils.MinMax.min.

◆ Lerp()

float JUtils.MinMax.Lerp ( float  time)
inline

Lerp from min to max

References JUtils.MinMax.max, and JUtils.MinMax.min.

◆ Random() [1/2]

float JUtils.MinMax.Random ( )
inline

Get a random value from min to max using UnityEngine.Random

Returns

◆ Random() [2/2]

float JUtils.MinMax.Random ( Random  random)
inline

Get a random value from min to max using System.Random

Property Documentation

◆ max

float JUtils.MinMax.max
get

Get the max value

◆ min

float JUtils.MinMax.min
get

Get the min value

◆ range

float JUtils.MinMax.range
get

Returns _max - _min


The documentation for this struct was generated from the following file: