Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better systems #233

Closed
Shadowblitz16 opened this issue Sep 9, 2024 · 4 comments
Closed

Better systems #233

Shadowblitz16 opened this issue Sep 9, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@Shadowblitz16
Copy link

Shadowblitz16 commented Sep 9, 2024

var world = World.Create();
world.AddSystem(PlayerMoveSystem)

public static void PlayerMoveSystem((Transform Transform,  PlayerMovement Movement)[] components)
{
    foreach (var component in components)
    { 
        component.Transform.Position += component.Movement.Velocity;
    }
}
@genaray
Copy link
Owner

genaray commented Sep 10, 2024

Have you looked at https://github.com/genaray/Arch.Extended/wiki/Source-Generator ? I would argue that its way better than bevy like systems tho :)

@genaray genaray added the enhancement New feature or request label Sep 10, 2024
@Shadowblitz16
Copy link
Author

Does it really require a constructor?

@stanoddly
Copy link

The suggestion doesn't seem to be actually even possible.

(Transform Transform, PlayerMovement Movement)[] is an array of a tuple of two components, in other words a reference (an array) to values (tuples) with two values (Transform and PlayerMovement). Any manipulation with component.Transform.Position changes only the tuple. And a tuple can't contain other references, because it's not a ref struct. So, the following is also not possible: (ref Transform Transform, ref PlayerMovement Movement)[].

@Shadowblitz16
Copy link
Author

ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants