Exemple #1
0
    public GameObject GetNode(int offset = 0)
    {
        var lastNode = generator.Nodes.Count - 1;

        if (nodeIndex + offset > lastNode - SafetyOffsetEnd)
        {
            placeObjects(generator.AddSegments(10));
        }
        var firstNodeOfSecondSegment = generator.Segments[0].Nodes.Count;

        if (nodeIndex > firstNodeOfSecondSegment + SafetyOffsetStart)
        {
            nodeIndex -= generator.RemoveSegments(1);
        }
        return(generator.Nodes[nodeIndex + offset]);
    }