/// <summary> /// Are there tags in this GameObject? /// </summary> /// <param name = "value">The gameobject</param> /// <param name = "tagsParameter">The tags that must have the GameObject</param> public static bool HasTags(this GameObject value, params Tags[] tagsParameter) { Debug.Assert(value != null && tagsParameter != null); auxMultiTags = value.GetComponent <MultiTags>(); if (auxMultiTags == null) { return(!(tagsParameter.Length > 0)); } return(AreThereTagsInList(auxMultiTags.ListTags, tagsParameter)); }
/// <summary> /// Return all tags in the specific GameObject /// </summary> /// <param name = "value">The specific gameobject</param> public static List <Tags> ReturnTags(this GameObject value) { Debug.Assert(value != null); auxMultiTags = value.GetComponent <MultiTags>(); if (auxMultiTags == null || auxMultiTags.ListTags.Count < 0) { return(null); } return(auxMultiTags.ListTags); }
/// <summary> /// Add these tags in the specific GameObject /// </summary> /// <param name = "value">The specific gameobject</param> /// <param name = "tagsParameter">The tags that must be added to the GameObject</param> public static void AddTags(this GameObject value, params Tags[] tagsParameter) { Debug.Assert(value != null && tagsParameter != null); auxMultiTags = value.AddOnlyOneComponent <MultiTags>(); for (int i = 0; i < tagsParameter.Length; i++) { if (auxMultiTags.ListTags.BinarySearch(tagsParameter[i]) < 0) { auxMultiTags.ListTags.Add(tagsParameter[i]); } } auxMultiTags.ListTags.Sort(); }
/// <summary> /// Remove these tags in the specific GameObject /// </summary> /// <param name = "value">The specific gameobject</param> /// <param name = "tagsParameter">The tags that must be removed to the GameObject</param> public static void RemoveTags(this GameObject value, params Tags[] tagsParameter) { Debug.Assert(value != null && tagsParameter != null); auxMultiTags = value.GetComponent <MultiTags>(); if (auxMultiTags == null || tagsParameter.Length == 0) { return; } for (int i = 0; i < tagsParameter.Length; i++) { auxMultiTags.ListTags.Remove(tagsParameter[i]); } auxMultiTags.ListTags.Sort(); }