66 lines
1.4 KiB
C#
66 lines
1.4 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using BITKit;
|
|
using Quadtree;
|
|
using Quadtree.Items;
|
|
using UnityEngine;
|
|
|
|
namespace BITFALL.Industry
|
|
{
|
|
public class UnityTechDeviceBase<T> :MonoBehaviour,ITechDevice,IItem<T,Node<T>> where T:UnityTechDeviceBase<T>
|
|
{
|
|
[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<T> _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<IWorldItemObject>();
|
|
}
|
|
|
|
protected virtual void Dispose()
|
|
{
|
|
ticker.Remove(OnTick);
|
|
}
|
|
|
|
protected virtual void OnTick(float obj)
|
|
{
|
|
|
|
}
|
|
public virtual Bounds GetBounds() => new(transform.position, Vector3.one);
|
|
|
|
Node<T> IItem<T, Node<T>>.ParentNode
|
|
{
|
|
get => _parentNode;
|
|
set => _parentNode = value;
|
|
}
|
|
|
|
public Node<T> ParentNode { get; set; }
|
|
public void QuadTree_Root_Initialized(IQuadtreeRoot<T, Node<T>> root)
|
|
{
|
|
}
|
|
}
|
|
}
|