Example #1
0
    public static bool RemoveTag(this GameObject target, ReTagIdentifier tag)
    {
        if (tagsCache.TryGetValue(target, out var ctag))
        {
            return(ctag.RemoveTag(tag));
        }

        if (target.GetComponent <ReTags>() is ReTags tags)
        {
            tagsCache.Add(target, tags);
            return(tags.RemoveTag(tag));
        }

        return(false);
    }
Example #2
0
    public static bool HasTag(this GameObject target, ReTagIdentifier tag)
    {
        if (!tagsCache.TryGetValue(target, out var _))
        {
            if (target.GetComponent <ReTags>() is ReTags tags)
            {
                tagsCache.Add(target, tags);
            }
            else
            {
                return(false);
            }
        }

        if (tag.Equals(AnyTag))
        {
            return(true);
        }

        return(tagsCache[target].HasTag(tag));
    }
Example #3
0
 public bool RemoveTag(ReTagIdentifier tag) => cachedTags.Remove(tag);
Example #4
0
 public bool SetTag(ReTagIdentifier tag) => cachedTags.Add(tag);
Example #5
0
 public bool HasTag(ReTagIdentifier tag) => cachedTags.Contains(tag);
Example #6
0
 public static bool HasTag(this MonoBehaviour target, ReTagIdentifier tag)
 {
     return(target.gameObject.HasTag(tag));
 }