mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 11:24:46 +00:00
35 lines
851 B
C#
35 lines
851 B
C#
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<int, Type> types)
|
|
{
|
|
types.Add(Transform,typeof(JNTransformComponent));
|
|
}
|
|
|
|
//查询组件
|
|
public T Query<T>(Entitas.Entity entity) where T : class, IComponent
|
|
{
|
|
return entity.GetComponent(GetIndex<T>()) as T;
|
|
}
|
|
|
|
}
|
|
} |