using System.Threading;
namespace BITKit.Core.Entites
{
///
/// 基本实体
///
public interface IEntity
{
ulong Id { get; }
#if UNITY
#else
bool TryGetComponent(out T component) where T : IEntityComponent;
IEntityComponent[] Components { get; }
bool RegisterComponent(T component) where T : IEntityComponent;
#endif
}
///
/// 基本实体组件
///
public interface IEntityComponent:IAwake,IStart
{
IEntity Entity { get; set; }
}
///
/// 基本实体服务
///
public interface IEntitiesService
{
///
/// 所有Entity
///
IEntity[] Entities { get; }
///
/// 注册Entity
///
///
///
bool Register(IEntity entity);
///
/// 注销Entity
///
///
///
bool UnRegister(IEntity entity);
CancellationToken CancellationToken { get; }
///
/// 查询Entity,例如
///
/// var rotationEntities=EntitiesService.Query<RotationComponent>
IEntity[] Query() where T : IEntityComponent;
}
}