Beispiel #1
0
        public void RemoveEntity(ECSEntity entity)
        {
            bool removed = entities.Remove(entity);

            if (removed)
            {
                OnEntityRemoved?.Invoke(entity);
            }
        }
Beispiel #2
0
        public void AddEntity(ECSEntity entity)
        {
            if (!entities.Contains(entity))
            {
                entities.Add(entity);
                OnEntityAdded?.Invoke(entity);

                entity.OnComponentAdded += cmp =>
                {
                    OnComponentAddedToEntity?.Invoke(entity, cmp);
                };

                entity.OnComponentRemoved += cmp => OnComponentRemovedToEntity?.Invoke(entity, cmp);
            }
        }