Пример #1
0
        protected override void OnRemoveComponent(UTinyEntity entity, UTinyObject component)
        {
            // We need to set the parent of the associated Unity Object to null.
            // And potentially move them outside of view.

            entity.SetParent(UTinyEntity.Reference.None);
            var children = entity.EntityGroup.Entities
                           .Deref(entity.Registry)
                           .Where(e =>
            {
                var t = e.GetComponent(entity.Registry.GetTransformType());
                return(null != t && (t.GetProperty <UTinyEntity.Reference>("parent")).Equals((UTinyEntity.Reference)entity));
            });

            foreach (var child in children)
            {
                child.SetParent(UTinyEntity.Reference.None);
            }
        }