Ejemplo n.º 1
0
        private static EntitySetBuilder Simple(EntitySetBuilder builder, Type[] componentTypes, MethodInfo method)
        {
            foreach (Type componentType in componentTypes)
            {
                method.MakeGenericMethod(componentType).Invoke(builder, null);
            }

            return(builder);
        }
Ejemplo n.º 2
0
        private static EntitySetBuilder Either(EntitySetBuilder builder, Type[] componentTypes, MethodInfo method)
        {
            EntitySetBuilder.EitherBuilder eitherBuilder = null;

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

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

            return(builder);
        }
Ejemplo n.º 3
0
 internal EitherBuilder(EntitySetBuilder builder, EitherType type)
 {
     _builder = builder;
     _type    = type;
 }
Ejemplo n.º 4
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="EntitySetBuilder"/> on which to create the rule.</param>
 /// <param name="componentTypes">The types of component.</param>
 /// <returns>The current <see cref="EntitySetBuilder"/>.</returns>
 public static EntitySetBuilder Without(this EntitySetBuilder builder, params Type[] componentTypes) => Simple(builder, componentTypes, _without);
Ejemplo n.º 5
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="EntitySetBuilder"/> on which to create the rule.</param>
 /// <param name="componentTypes">The types of component.</param>
 /// <returns>The current <see cref="EntitySetBuilder"/>.</returns>
 public static EntitySetBuilder WhenRemovedEither(this EntitySetBuilder builder, params Type[] componentTypes) => Either(builder, componentTypes, _whenRemovedEither);
Ejemplo n.º 6
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="EntitySetBuilder"/> on which to create the rule.</param>
 /// <param name="componentTypes">The types of component.</param>
 /// <returns>The current <see cref="EntitySetBuilder"/>.</returns>
 public static EntitySetBuilder WithoutEither(this EntitySetBuilder builder, params Type[] componentTypes) => Either(builder, componentTypes, _withoutEither);
Ejemplo n.º 7
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="EntitySetBuilder"/> on which to create the rule.</param>
 /// <param name="componentTypes">The types of component.</param>
 /// <returns>The current <see cref="EntitySetBuilder"/>.</returns>
 public static EntitySetBuilder WhenRemoved(this EntitySetBuilder builder, params Type[] componentTypes) => Simple(builder, componentTypes, _whenRemoved);