Пример #1
0
        public void OnEntityRemovedFromPool(EntityRemovedEvent args)
        {
            if (!args.Entity.Components.Any())
            {
                return;
            }

            var matchesGroup = args.Entity.HasComponents(ComponentTypes);

            if (matchesGroup)
            {
                OnEntityRemoved.OnNext(args.Entity);
            }
        }
Пример #2
0
        private void HandleEntityRemoved(object sender, EntityRemovedEventArgs e)
        {
            Models.Entity entity = new Models.Entity()
            {
                ID            = e.Entity.ID,
                Type          = (Models.EntityType)((int)e.Entity.Type),
                ModelIndex    = e.Entity.ModelIndex,
                ModelLocation = e.Entity.ModelLocation,
                Position      = new Models.Vector(e.Entity.Position.X, e.Entity.Position.Y, e.Entity.Position.Z),
                Rotation      = new Models.Vector(e.Entity.Rotation.X, e.Entity.Rotation.Y, e.Entity.Rotation.Z),
            };

            EntityRemovedEvent newEvent = new EntityRemovedEvent()
            {
                Entity   = entity,
                EntityID = e.Entity.ID,
            };

            CurrentTick.Events.Add(newEvent);
        }