basevaluedescriptor - eisclimber/ExPresS-XR GitHub Wiki

BaseValueDescriptor

Class in ExPresSXR.Interaction.ValueRangeInteractable

Inherits from ValueDescriptor\<V\>

Summary

This class is the base implementation of a value range to define the behavior of interpolating a value. This is currently used to hold the information needed for ExPresS XR#s ValueRangeInteractables, such as Levers, sliders, ...

You can of course create your own range by inheriting from BaseValueDescriptor (NOT ValueDescriptor !). You'll need to implement the ProcessNewValue() function to handle and return new values as you like. To define the bounds of your range also implement IsMinValue() and IsMinValue() to properly trigger the respective events. Keep in mind, that a range may have multiple min/max values. Make sure to add a [System.Serializable] attribute to your ValueDescriptor-class.

In case you want or to add attributes to your serialized value-field (like Float01Range ) you'll need to inherit from ValueDescriptor . If you to that, you will need to implement the behavior of the Value property yourself, setting your value to the return value of ProcessNewValue() and calling HandleValueChange() with the old value. It is usually sufficient to call the

public abstract class BaseValueDescriptor<V> : ValueDescriptor<V>

Type Parameters

Name Description
V Class used to interpolate between.

Properties

Name Description
Value Property for getting and setting the value. If you do not need to add custom attributes (like [Range(..)]) to your value field,
you can use BaseValueDescriptor , which has the property already set up.
Otherwise you'll need to implement it yourself, making sure to call the same functions as in BaseValueDescriptor ,
to ensure a correct behavior.
⚠️ **GitHub.com Fallback** ⚠️