Beispiel #1
0
        public ComponentArray <T> GetComponentArray <T>()
        {
            var r = componentArrays[ComponentTypeManager.GetTypeIndex <T>()];

            if (r == null)
            {
                throw new ArgumentException($"Entity not contains component of type {typeof(T)}");
            }
            return((ComponentArray <T>)r);
        }
Beispiel #2
0
        public bool HasComponent <T>()
        {
            var typeId = ComponentTypeManager.GetTypeIndex <T>();

            return(componentArrays.Length > typeId && componentArrays[typeId] != null);
        }