Пример #1
0
        private static EntityQueryBuilder Simple(EntityQueryBuilder builder, Type[] componentTypes, MethodInfo method)
        {
            foreach (Type componentType in componentTypes.CheckArgumentNullException(nameof(componentTypes)))
            {
                method.MakeGenericMethod(componentType).Invoke(builder, null);
            }

            return(builder);
        }
Пример #2
0
        private static EntityQueryBuilder Simple(EntityQueryBuilder builder, Type[] componentTypes, MethodInfo method)
        {
            foreach (Type componentType in componentTypes)
            {
                method.MakeGenericMethod(componentType).Invoke(builder, null);
            }

            return(builder);
        }
Пример #3
0
        private static EntityQueryBuilder Either(EntityQueryBuilder builder, Type[] componentTypes, MethodInfo method)
        {
            EntityQueryBuilder.EitherBuilder eitherBuilder = null;

            foreach (Type componentType in componentTypes.CheckArgumentNullException(nameof(componentTypes)))
            {
                if (eitherBuilder is null)
                {
                    eitherBuilder = (EntityQueryBuilder.EitherBuilder)method.MakeGenericMethod(componentType).Invoke(builder, null);
                }
                else
                {
                    _or.MakeGenericMethod(componentType).Invoke(eitherBuilder, null);
                }
            }

            if (eitherBuilder != null)
            {
                _commit.Invoke(eitherBuilder, null);
            }

            return(builder);
        }
 internal EitherBuilder(EntityQueryBuilder builder, EitherType type)
 {
     _builder = builder;
     _type    = type;
 }
Пример #5
0
 /// <summary>
 /// Makes a rule to ignore <see cref="Entity"/> with at least one component of the given types.
 /// </summary>
 /// <param name="builder">The <see cref="EntityQueryBuilder"/> on which to create the rule.</param>
 /// <param name="componentTypes">The types of component.</param>
 /// <returns>The current <see cref="EntityQueryBuilder"/>.</returns>
 public static EntityQueryBuilder Without(this EntityQueryBuilder builder, params Type[] componentTypes) => Simple(builder, componentTypes, _without);
Пример #6
0
 /// <summary>
 /// Makes a rule to observe <see cref="Entity"/> when one component of the given types is removed.
 /// </summary>
 /// <param name="builder">The <see cref="EntityQueryBuilder"/> on which to create the rule.</param>
 /// <param name="componentTypes">The types of component.</param>
 /// <returns>The current <see cref="EntityQueryBuilder"/>.</returns>
 public static EntityQueryBuilder WhenRemovedEither(this EntityQueryBuilder builder, params Type[] componentTypes) => Either(builder, componentTypes, _whenRemovedEither);
Пример #7
0
 /// <summary>
 /// Makes a rule to obsverve <see cref="Entity"/> without at least one component of the given types.
 /// </summary>
 /// <param name="builder">The <see cref="EntityQueryBuilder"/> on which to create the rule.</param>
 /// <param name="componentTypes">The types of component.</param>
 /// <returns>The current <see cref="EntityQueryBuilder"/>.</returns>
 public static EntityQueryBuilder WithoutEither(this EntityQueryBuilder builder, params Type[] componentTypes) => Either(builder, componentTypes, _withoutEither);
Пример #8
0
 /// <summary>
 /// Makes a rule to obsverve <see cref="Entity"/> when all component of the given types are removed.
 /// </summary>
 /// <param name="builder">The <see cref="EntityQueryBuilder"/> on which to create the rule.</param>
 /// <param name="componentTypes">The types of component.</param>
 /// <returns>The current <see cref="EntityQueryBuilder"/>.</returns>
 public static EntityQueryBuilder WhenRemoved(this EntityQueryBuilder builder, params Type[] componentTypes) => Simple(builder, componentTypes, _whenRemoved);