10 [Serializable]
public class Set<T> :
Pick<T> {
11 #region Inspector Fields 13 [SerializeField]
private T[] elements =
default;
15 [SerializeField, Tooltip(
"true for sequential, false for random")]
16 private bool cycle =
false;
20 "If the list is shorter then select items randomly, but never choose one a second time until all have been picked. This is useful for short lists to reduce unexpected repeats.")]
21 private int exhaustiveBelow = 10;
27 $
"Set {GetType().Name}: Size = {elements.Length}, Cycle = {cycle}, Exhaustive Below = {exhaustiveBelow}";
35 selector.Choices = elements;
50 if (selector == null) {
51 selector =
new Selector<T>() {ExhaustiveBelow = exhaustiveBelow, IsRandom = !cycle};
override string ToString()
//#TBD#//
T Pick()
Pick one item from many
T Pick()
Method called to pick an item
virtual void BuildSelector()
Rebuild selections if we change contents
void Reset()
Remove all set entries
Pick one item from a list.
Interface so that code can use a picker without know more about the source. A picker returns a value ...
int InitialSize
//#TBD#//
Create a set in the inspector and provide an interface to pick one