Releases: OctopBP/morpeh-source-generation
Releases · OctopBP/morpeh-source-generation
0.2.0
New filter
Now you can use generic filters. The first type or tuple defines with
components, and an optional second type or tuple defines without
components.
// Some examples
private Filter<Player> _anyPlayerFilter;
private Filter<Player, Disabled> _activePlayerFilter;
private Filter<(Player, Transform), Disabled> _playerWithTransformFilter;
private Filter<(Player, Transform), (Dead, Disabled)> _alivePlayerFilter;
Stash extensions
There are new extensions for Stashes generated for each component.
For marker components without fields, there is the SetOrRemove(Entity entity, bool setOrRemove)
extension.
// Some examples
struct SomeComponent : IComponent {}
Stash<SomeComponent> _someStash;
var toggle = /*...*/;
_someStash.SetOrRemove(entity, toggle);
For components with fields, there is the new Set(Entity entity, /*...*/)
extension. This allows you to assign values directly without creating a new structure.
// Some examples
struct SomeComponent : IComponent
{
public int Value;
}
Stash<SomeComponent> _someStash;
_someStash.Set(entity, value: 10);
Register attribute
A new attribute can be added to a system field in a feature. This system will be registered in the DI container and can be injected into other systems.
public partial class SomeFeature : IFeature
{
[Register] private readonly SomeServiceSystem _someServiceSystem;
}