iFactory.Cutting.Unity/Assets/BITKit/Unity/Pool/PoolObject.cs

38 lines
936 B
C#
Raw Normal View History

2024-06-03 10:11:43 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using ZXing.QrCode.Internal;
namespace BITKit
{
public interface IPoolObject
{
ValidHandle EnabledHandle { get; }
}
[CustomType(typeof(IPoolObject))]
public class PoolObject : MonoBehaviour, IPoolObject
{
[SerializeField, ReadOnly] private bool isEnabled;
[SerializeField, ReadOnly(HideLabel = true), TextArea] private string report;
public ValidHandle EnabledHandle { get; } = new();
private void Awake()
{
EnabledHandle.AddListener(OnEnabled);
}
private void OnEnabled(bool obj)
{
isEnabled = obj;
report = EnabledHandle.ToString();
}
[BIT]
private void Check()
{
isEnabled = EnabledHandle.Allow;
report = EnabledHandle.ToString();
}
}
}