Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Leopotam.Ecs;
- namespace TestLeoEcs.tests
- {
- public class TestUpdateFilters
- {
- private EcsWorld _world;
- private EcsSystems _systems;
- public TestUpdateFilters()
- {
- _world = new EcsWorld();
- _systems = new EcsSystems(_world);
- _systems.Add(new RemoveEntitySystem());
- _systems.ProcessInjects();
- _systems.Init();
- _systems.Run();
- _world.EndFrame();
- }
- }
- public class RemoveEntitySystem : IEcsInitSystem, IEcsRunSystem
- {
- EcsWorld _world;
- private EcsFilter<IncludeComponent> _incFilter;
- private EcsFilter<IncludeComponent>.Exclude<ExcludeComponent> _incExFilter;
- public void Init()
- {
- _world.NewEntityWith<IncludeComponent>(out var includeComponent1);
- _world.NewEntityWith<IncludeComponent, ExcludeComponent>(out var includeComponent2, out var excludeComponent);
- }
- public void Run()
- {
- ref var entity = ref _incFilter.Entities[0];
- entity.Destroy();
- }
- }
- public class IncludeComponent
- {}
- public class ExcludeComponent : IEcsOneFrame, IEcsIgnoreInFilter
- {}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement