using System; using System.Collections.Generic; using Entitas; using JNGame.EntitasExtend; using JNGame.Sync.Frame.Entity.Component.Components; using JNGame.Util.Types; namespace JNGame.Sync.Frame.Entity.Components { public class JNEntityLookup : EntitasExtend.JNLookup { //位置组件 public int Transform { get; set; } //绑定索引 protected override void BindIndex() { Transform = Next(); } //绑定类型 protected override void BindType(KeyValue types) { types.Add(Transform,typeof(JNTransformComponent)); } //查询组件 public T Query(Entitas.Entity entity) where T : class, IComponent { return entity.GetComponent(GetIndex()) as T; } } }