using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; public class Taggable : MonoBehaviour { public List targetTag = new List(); public bool IsValidTarget(List tags) { for (int i = 0; i < targetTag.Count; i++) { if (tags.Contains(targetTag[i])) return true; } return false; } public bool AlliedTagsContains(List tags) { for (int i = 0; i < targetTag.Count; i++) { for (int j = 0; j < tags.Count; j++) { if (targetTag[i].AlliedTags.Contains(tags[j])) return true; } } return false; } public bool HasSameTag(List tags) { for (int i = 0; i < targetTag.Count; i++) { if (tags.Contains(targetTag[i])) return true; } return false; } //private IEnumerable commonItems; //public bool IsValidTarget(List tags) //{ // commonItems = this.tags.Intersect(tags); // // return commonItems.Any(); //} }