Version GitHub

# Auto Injections for [DragonECS](https://github.com/DCFApixels/DragonECS) | Languages: | [Русский](https://github.com/DCFApixels/DragonECS-AutoInjections/blob/main/README-RU.md) | [English(WIP)](https://github.com/DCFApixels/DragonECS-AutoInjections) | | :--- | :--- | :--- | The extension is designed to reduce the amount of code by simplifying dependency injection by doing injections automatically. > **NOTICE:** The project is a work in progress, API may change. > While the English version of the README is incomplete, you can view the [Russian version](https://github.com/DCFApixels/DragonECS/blob/main/README-RU.md). # Code Example ```csharp class VelocitySystemDI : IEcsRunProcess { class Subject : EcsSubjectDI { [ExcImplicit(typeof(FreezedTag))] [Inc] public EcsPool poses; [Inc] public EcsPool velocities; } [EcsInject] EcsDefaultWorld _world; [EcsInject] TimeService _time; public void Run(EcsPipeline pipeline) { foreach (var e in _world.Where(out Subject s)) { s.poses.Write(e).position += s.velocities.Read(e).value * _time.DeltaTime; } } } ```
Same code but without AutoInjections ```csharp class VelocitySystem : IEcsRunProcess, IEcsInject, IEcsInject { class Subject : EcsSubject { public EcsPool poses; public EcsPool velocities; public Subject(Builder b) { b.Exclude(); poses = b.Include(); velocities = b.Include(); } } EcsDefaultWorld _world; TimeService _time; public void Inject(EcsDefaultWorld obj) => _world = obj; public void Inject(TimeService obj) => _time = obj; public void Run(EcsPipeline pipeline) { foreach (var e in _world.Where(out Subject s)) { s.poses.Write(e).position += s.velocities.Read(e).value * _time.DeltaTime; } } } ```