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); }
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)); }
public bool RemoveTag(ReTagIdentifier tag) => cachedTags.Remove(tag);
public bool SetTag(ReTagIdentifier tag) => cachedTags.Add(tag);
public bool HasTag(ReTagIdentifier tag) => cachedTags.Contains(tag);
public static bool HasTag(this MonoBehaviour target, ReTagIdentifier tag) { return(target.gameObject.HasTag(tag)); }