Пример #1
0
 public static void SetState()
 {
     Locate.SetDirty();
     Hook.LoadSettings();
     foreach (var current in Locate.GetSceneObjects())
     {
         if (current.name != "@Main")
         {
             continue;
         }
         current.hideFlags = Hook.hidden ? HideFlags.HideInHierarchy : HideFlags.None;
         if (Hook.temporary)
         {
             current.hideFlags = Hook.hidden ? HideFlags.HideAndDontSave : HideFlags.DontSave;
         }
     }
     Utility.Destroy(new GameObject("@*#&"));
 }
Пример #2
0
 public static GameObject[] GetSiblings(this GameObject current, bool includeEnabled = true, bool includeDisabled = true, bool includeSelf = true)
 {
     if (Application.isLoadingLevel)
     {
         return(new GameObject[0]);
     }
     if (!Locate.cleanSiblings.Contains(current))
     {
         GameObject        parent = current.GetParent();
         List <GameObject> siblings;
         if (parent.IsNull())
         {
             Locate.GetSceneObjects(includeEnabled, includeDisabled);
             siblings = Locate.rootObjects.Remove(current).ToList();
         }
         else
         {
             siblings = parent.GetComponentsInChildren <Transform>(true).Select(x => x.gameObject).ToList();
             siblings.RemoveAll(x => x.GetParent() != parent);
         }
         Locate.siblings[current]         = siblings.ToArray();
         Locate.enabledSiblings[current]  = Locate.siblings[current].Where(x => !x.IsNull() && x.gameObject.activeInHierarchy).Select(x => x.gameObject).ToArray();
         Locate.disabledSiblings[current] = Locate.siblings[current].Where(x => !x.IsNull() && !x.gameObject.activeInHierarchy).Select(x => x.gameObject).ToArray();
         Locate.cleanSiblings.Add(current);
     }
     GameObject[] results = Locate.enabledSiblings[current];
     if (includeEnabled && includeDisabled)
     {
         results = Locate.siblings[current];
     }
     if (!includeEnabled)
     {
         results = Locate.disabledSiblings[current];
     }
     if (!includeSelf)
     {
         results = results.Remove(current);
     }
     return(results);
 }