1
This commit is contained in:
@@ -8,19 +8,10 @@ namespace BITKit
|
||||
{
|
||||
public class Tag : MonoBehaviour,ITag
|
||||
{
|
||||
[Header(Constant.Header.Settings)]
|
||||
[Tooltip("It's will be deprecated in the future, use reference instead.")]
|
||||
[SerializeField] private string[] tags;
|
||||
[Tooltip("Disable when tags is not empty")]
|
||||
[SerializeReference,SubclassSelector] private IReference[] reference;
|
||||
public int Hash => _id is 0 ? _id = MathE.GetHash(GetTags()) : _id;
|
||||
public int Hash => _id is 0 ? _id = MathE.GetHash(Tags) : _id;
|
||||
private int _id;
|
||||
public string[] GetTags() => CacheTags ??= reference?.Length > 0 ? reference.Select(x => x.Value).ToArray() : tags;
|
||||
private string[] CacheTags;
|
||||
public void SetTags(IReference[] newReference)
|
||||
{
|
||||
reference = newReference;
|
||||
CacheTags = null;
|
||||
}
|
||||
public IReadOnlyCollection<string> Tags=> _cacheTags ??= reference.Select(x => x.Value).ToArray();
|
||||
private string[] _cacheTags;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user