internal static bool TryGetMultiTag(GameObject go, out MultiTag c)
 {
     if( _pool.TryGetValue(go, out c))
     {
         return true;
     }
     else if (go.CompareTag(SPConstants.TAG_MULTITAG))
     {
         c = go.GetComponent<MultiTag>();
         return c != null;
     }
     return false;
 }
Beispiel #2
0
 internal static bool TryGetMultiTag(GameObject go, out MultiTag c)
 {
     return(_pool.TryGet(go, out c));
 }
Beispiel #3
0
        public static void AddTags(this GameObject go, GameObject source)
        {
            if (go == null)
            {
                throw new System.ArgumentNullException("go");
            }
            if (source == null)
            {
                throw new System.ArgumentNullException("source");
            }

            MultiTag multitag;

            if (MultiTag.TryGetMultiTag(go, out multitag))
            {
                MultiTag otherMultiTag;
                if (MultiTag.TryGetMultiTag(source, out otherMultiTag))
                {
                    var e = otherMultiTag.GetEnumerator();
                    while (e.MoveNext())
                    {
                        multitag.AddTag(e.Current);
                    }
                }
                else
                {
                    multitag.AddTag(source.tag);
                }
            }
            else
            {
                MultiTag otherMultiTag;
                if (MultiTag.TryGetMultiTag(source, out otherMultiTag))
                {
                    if (otherMultiTag.Count > 1 || !go.CompareTag(SPConstants.TAG_UNTAGGED))
                    {
                        var oldtag = go.tag;
                        multitag = go.AddComponent <MultiTag>();
                        multitag.AddTag(oldtag);
                        var e = otherMultiTag.GetEnumerator();
                        while (e.MoveNext())
                        {
                            multitag.AddTag(e.Current);
                        }
                    }
                    else
                    {
                        go.tag = otherMultiTag[0];
                    }
                }
                else if (!source.CompareTag(SPConstants.TAG_UNTAGGED))
                {
                    if (go.CompareTag(SPConstants.TAG_UNTAGGED))
                    {
                        go.tag = source.tag;
                    }
                    else
                    {
                        go.AddTag(source.tag);
                    }
                }
            }
        }
Beispiel #4
0
 public void Dispose()
 {
     _multi   = null;
     _index   = 0;
     _current = null;
 }
Beispiel #5
0
 public Enumerator(MultiTag multi)
 {
     _multi   = multi;
     _index   = 0;
     _current = null;
 }