1
This commit is contained in:
@@ -18,9 +18,12 @@ namespace BITKit.Entities
|
||||
public class Entity : MonoBehaviour, IUnityEntity
|
||||
{
|
||||
private readonly GenericEvent genericEvent = new();
|
||||
|
||||
|
||||
public int Id { get; set; }
|
||||
[SerializeField,ReadOnly] private int id;
|
||||
public int Id
|
||||
{
|
||||
get => id;
|
||||
set => id = value;
|
||||
}
|
||||
public CancellationToken CancellationToken { get; private set; }
|
||||
public IEntityBehavior[] Behaviors { get;private set; }
|
||||
public IEntityComponent[] Components => Behaviors.Cast<IEntityComponent>().ToArray();
|
||||
@@ -251,18 +254,18 @@ namespace BITKit.Entities
|
||||
public void Set<T>(T value) => genericEvent.Set<T>(value);
|
||||
public void Set<T>(string key = Constant.System.Internal, T value = default) => genericEvent.Set<T>(key, value);
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
[UnityEditor.CustomEditor(typeof(Entity))]
|
||||
public class EntityInspector : BITInspector<Entity>
|
||||
{
|
||||
public override VisualElement CreateInspectorGUI()
|
||||
{
|
||||
FillDefaultInspector();
|
||||
CreateSubTitle("Identity");
|
||||
var idLabel = root.Create<Label>();
|
||||
idLabel.text = agent.Id.ToString();
|
||||
return root;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// #if UNITY_EDITOR
|
||||
// [UnityEditor.CustomEditor(typeof(Entity))]
|
||||
// public class EntityInspector : BITInspector<Entity>
|
||||
// {
|
||||
// public override VisualElement CreateInspectorGUI()
|
||||
// {
|
||||
// FillDefaultInspector();
|
||||
// CreateSubTitle("Identity");
|
||||
// var idLabel = root.Create<Label>();
|
||||
// idLabel.text = agent.Id.ToString();
|
||||
// return root;
|
||||
// }
|
||||
// }
|
||||
// #endif
|
||||
}
|
Reference in New Issue
Block a user