Vector2 RangeValue { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The RangeValue property of the RangedFloat struct represents the range of values as a Vector2. The x component of the Vector2 corresponds to the minimum value, and the y component corresponds to the maximum value. Setting this property will convert the RangedFloat to a range value, allowing for randomization between the specified minimum and maximum values.

Usage

To use the RangeValue property, you can directly set it with a Vector2 to define the range of the float. This will automatically adjust the RangedFloat to operate in range mode, allowing you to retrieve a random value within the specified range using the GetValue method.

Example

// Example of setting the RangeValue property
RangedFloat rangedFloat = new RangedFloat();
rangedFloat.RangeValue = new Vector2(1.0f, 5.0f);

// Retrieve a random value within the range
float randomValue = rangedFloat.GetValue();

// Output the range values
Console.WriteLine($"Range Min: {rangedFloat.Min}, Range Max: {rangedFloat.Max}");

// Output the random value
Console.WriteLine($"Random Value: {randomValue}");