public ref T GetComponent <T>() { var t = (ComponentData <T>)Chunk.ComponentDatas[ComponentTypeManager.GetTypeIndex <T>()]; if (t == null) { throw new EntitiesException($"Entity doesn't have component of type \"{typeof(T)}\""); } return(ref t[IndexInChunk]); }
public void SetComponent <T>(T data) { var t = (ComponentData <T>)Chunk.ComponentDatas[ComponentTypeManager.GetTypeIndex <T>()]; if (t == null) { throw new EntitiesException($"Entity doesn't have component of type \"{typeof(T)}\""); } t[IndexInChunk] = data; }
public static ComponentType Create(Type type) { return(new ComponentType(ComponentTypeManager.GetTypeIndex(type))); }
public bool HasNotNullComponent <T>() where T : class { var chunkComponentData = Chunk.ComponentDatas[ComponentTypeManager.GetTypeIndex <T>()]; return(((ComponentData <T>)chunkComponentData)?[IndexInChunk] != null); }
public static ComponentType Create <T>() { return(new ComponentType(ComponentTypeManager.GetTypeIndex <T>())); }