Created
April 7, 2020 19:11
-
-
Save korchoon/99b499178416950ee3d393c5b520c824 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public BezierSegment TryGetNextSegment() { | |
if (IsInValidChain == false) | |
return null; | |
var thisIndex = transform.GetSiblingIndex(); | |
var isLast = thisIndex == transform.parent.childCount - 1; | |
BezierSegment GetSiblingSegment(int i) => transform.parent.GetChild(i).GetComponent<BezierSegment>(); | |
if (isLast && BezierChain.loop) | |
return GetSiblingSegment(0); // First segment | |
return isLast ? null : GetSiblingSegment(thisIndex + 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment