SR StartPointPickers - Smehi/WaveOne GitHub Wiki

StartPointPickers allow you to determine how the start points from the list in the start point script get chosen. Here the contents of the picker don't really matter. What we are after is the IStartPointPicker interface. All custom start point pickers implement this interface. This means that using the pickers is the same no matter which implementation we use.

IStartPointPicker methods

void SetListSize(int size)

This is used to set the size in the picker. The picker has to have a reference to the size so it can correctly pick the next point.

For example in your StartPoint script you would do something like this:

private IStartPointPicker startPointPicker;

private void Start()
{
    ...

    // Get a reference to the picker by searching for the interface.
    // Then set the size with the amount of start points.
    startPointPicker = GetComponent<IStartPointPicker>();
    startPointPicker.SetListSize(startPoints.Count);

    ...
}

int GetIndex()

Get next index in the way that the picker is set up (InOrder/ReverseOrder/etc.).

To use this in your StartPoint script:

private Vector3 Example()
{
    ...

    // Get the index and use it as the index for list of points.
    return startPoints[startPointPicker.GetIndex()].position;

    ...
}
⚠️ **GitHub.com Fallback** ⚠️