Arch.Extended icon indicating copy to clipboard operation
Arch.Extended copied to clipboard

Is it possiable to implicitly query the components like this?

Open Shadowblitz16 opened this issue 1 year ago • 1 comments

So we have this...

public class MovementSystem(World world) : BaseSystem<World, float>(world)
{
    private QueryDescription _description = new QueryDescription().WithAll<Position, Velocity>();
    public override void Update(in float delta)
    {
        base.Update(in delta);
        World.Query(in _description, (ref Position position, ref Velocity velocity) =>
        {
            position.Value += velocity.Value;
        });
    }
}

By using source generators on generics to get varadic generaics can we get something like this?

public class MovementSystem(World world) : BaseSystem<World, float>(world)
{
    public override void Update(in float delta)
    {
        base.Update(in delta);
        World.Query((ref Position position, ref Velocity velocity) =>
        {
            position.Value += velocity.Value;
        });
    }
}

Shadowblitz16 avatar Oct 11 '24 21:10 Shadowblitz16

Thats possible, however that would defeat the purpose of the query description... actually filtering the entities. You could theoretically add those yourself tho

genaray avatar Oct 23 '24 19:10 genaray