private void HandleEntityRemoved(object sender, EntityEventArgs args) { var removed = Entities.Remove(args.Entity); if (removed) { OnEntityRemoved(args); } }
private void HandleEntityAdded(object sender, EntityEventArgs args) { foreach (var binding in Bindings) { if (!args.Entity.Components.TryGetValue(binding, out var value)) { return; } } Entities.Add(args.Entity); OnEntityAdded(args); }
protected internal void OnEntityRemoved(EntityEventArgs args) { args.Entity.ComponentAdded -= HandleComponentAdded; args.Entity.ComponentRemoved -= HandleComponentRemoved; EntityRemoved?.Invoke(this, args); }
protected void OnEntityRemoved(EntityEventArgs args) { EntityRemoved?.Invoke(this, args); }