Example #1
0
        /// <summary>
        /// Reorders components to match the local component type codes.
        /// </summary>
        public void LocalizeTypeCodes()
        {
            var oldComponents = Components.Where(i => i != null).ToList();

            Components.Clear();
            foreach (var component in oldComponents)
            {
                var typeCode = ComponentTypeCode.Get(component.GetType());
                Components[typeCode.TypeCode] = component;
            }
        }
Example #2
0
 public Component[] GetComponents() =>
 Entity.GetComponents().Where(i => ComponentFilter[ComponentTypeCode.Get(i.GetType())]).ToArray();