Selector

What is a Selector?


A Selector is a C# class that is used in various locations to retrieve a certain value from a range of values. The values and the selection can be dynamically calculated at runtime.

Values


The values can be choosen in three different ways:

  • Attribute Type: Must be an Attribute Type that has a min-max float range or an enum of values.
  • Min Max: A min-max float range.
  • Choices: A enumeration of values.

Selection


The Selection can be done in three different ways:

  • Current Or Default Value: If the value is an Attribute Type it will pick the current level, else it will pick the default value of the Min Max or Choice object.
  • Fixed Value: The value can be directly selected in the Editor UI.
  • Selector Type: Dynamic runtime selection logic which can be created with a Selector Type.

Selector Type


Provides a comprehesive way to select a value. At its core is a list of weighted Selector Factors. The min value, start value, and end value can be selected and he Selector Factors determine the final value.

See Selector Type Inspector.

Selector Factor


Selector Factors follow the Scriptable Object custom logic pattern. Selector Factor is an abstract base class that inherits from Scriptable Object. It's children only need to implement the Evaluate method that returns the calculated float value for this Selector Factor.

See Selector Factor Script.