Ejemplo n.º 1
0
        public static GameObject GetPreviousSibling(this GameObject current, bool includeInactive = false)
        {
            GameObject[] siblings = Locate.GetSiblings(current, true, includeInactive);
            if (siblings.Length == 0)
            {
                return(current);
            }
            int previousIndex = siblings.IndexOf(current) - 1;

            if (previousIndex < 0)
            {
                previousIndex = siblings.Length - 1;
            }
            return(siblings[previousIndex].gameObject);
        }
Ejemplo n.º 2
0
        public static GameObject GetNextSibling(this GameObject current, bool includeInactive = false)
        {
            GameObject[] siblings = Locate.GetSiblings(current, true, includeInactive);
            if (siblings.Length == 0)
            {
                return(current);
            }
            int nextIndex = siblings.IndexOf(current) + 1;

            if (nextIndex >= siblings.Length)
            {
                nextIndex = 0;
            }
            return(siblings[nextIndex].gameObject);
        }
Ejemplo n.º 3
0
 public static int GetSiblingCount(this GameObject current, bool includeInactive = false)
 {
     return(Locate.GetSiblings(current, true, includeInactive).Length);
 }