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

Use ICleanupStrategy as really strategy #54

Open
rapushka opened this issue Nov 30, 2023 · 0 comments
Open

Use ICleanupStrategy as really strategy #54

rapushka opened this issue Nov 30, 2023 · 0 comments
Labels
overthink to give this issue second thougt

Comments

@rapushka
Copy link
Owner

not as just marker

i.e

	[PublicAPI]
	public interface ICleanup<TStrategy> where TStrategy : ICleanupStrategy { }

	public interface ICleanupStrategy 
	{
		void OnCleanup(Entity<TScope> entity);
	}

	public class RemoveComponent : ICleanupStrategy
	{
		public void OnCleanup(Entity<TScope> entity)
		{
			if (entity.Has<TComponent>())
				entity.Remove<TComponent>();
		}
	}

	public class DestroyEntity : ICleanupStrategy
	{
		public void OnCleanup(Entity<TScope> entity)
		{
			entity.Destroy();
		}
	}

❗ problem: from where take the scope of the entity and the component?

@rapushka rapushka added the overthink to give this issue second thougt label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
overthink to give this issue second thougt
Projects
None yet
Development

No branches or pull requests

1 participant