using System; using System.Collections; using System.Collections.Generic; using BITKit; using Quadtree; using Quadtree.Items; using UnityEngine; namespace BITFALL.Industry { public class UnityTechDeviceBase :MonoBehaviour,ITechDevice,IItem> where T:UnityTechDeviceBase { [Header(nameof(MonoBehaviour))] [SerializeReference, SubclassSelector] private ITicker ticker; [Header(nameof(ITechDevice))] [SerializeField] private int techLevel; [SerializeField] private TechDeviceHealth health; protected IWorldItemObject worldItemObject; public int Id => id is 0 ? id = GetInstanceID() : id; private int id; private Node _parentNode; public int TechLevel { get=>techLevel; set=>techLevel=value; } public TechDeviceHealth Health { get=>health; set=>health=value; } protected virtual void Start() { ticker.Add(OnTick); destroyCancellationToken.Register(Dispose); worldItemObject = GetComponent(); } protected virtual void Dispose() { ticker.Remove(OnTick); } protected virtual void OnTick(float obj) { } public virtual Bounds GetBounds() => new(transform.position, Vector3.one); Node IItem>.ParentNode { get => _parentNode; set => _parentNode = value; } public Node ParentNode { get; set; } public void QuadTree_Root_Initialized(IQuadtreeRoot> root) { } } }