From a22c505984697881f5f911a165ee022087b69e09 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Mon, 20 May 2024 22:36:58 +0800 Subject: *rename --- Thronefall_v1.0/Decompile/TaggedObject.cs | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Thronefall_v1.0/Decompile/TaggedObject.cs (limited to 'Thronefall_v1.0/Decompile/TaggedObject.cs') diff --git a/Thronefall_v1.0/Decompile/TaggedObject.cs b/Thronefall_v1.0/Decompile/TaggedObject.cs new file mode 100644 index 0000000..d6bede0 --- /dev/null +++ b/Thronefall_v1.0/Decompile/TaggedObject.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using UnityEngine; + +public class TaggedObject : MonoBehaviour +{ + [SerializeField] + private List tags = new List(); + + private TagManager tagManager; + + private Hp hp; + + public Collider colliderForBigOjectsToMeasureDistance; + + public List Tags => tags; + + public Hp Hp => hp; + + private void Start() + { + hp = GetComponent(); + } + + private void OnEnable() + { + if (tagManager == null) + { + tagManager = TagManager.instance; + } + tagManager.AddTaggedObject(this); + } + + private void OnDisable() + { + if (tagManager == null) + { + tagManager = TagManager.instance; + } + tagManager.RemoveTaggedObject(this); + } + + public void AddTag(TagManager.ETag _tag) + { + if (!tags.Contains(_tag)) + { + tags.Add(_tag); + tagManager.AddTag(this, _tag); + } + } + + public void RemoveTag(TagManager.ETag _tag) + { + if (tags.Contains(_tag)) + { + tags.Remove(_tag); + tagManager.RemoveTag(this, _tag); + } + } +} -- cgit v1.1-26-g67d0