コード例 #1
0
        public bool Clone(EntityReference source, Entity target, Depth depth = Depth.Shallow, bool pool = true)
        {
            if (Debug.isDebugBuild)
            {
                _components.Set(target, new Components.Debug {
                    Name = source.Name
                });
            }

            var cloned = false;

            using (var list = _references.Use())
            {
                source.GetComponents(list.Instance);
                foreach (var component in list.Instance)
                {
                    cloned |= _delegates.Get(component.GetType()).Set(component, target, _world);
                }
            }

            if (pool)
            {
                _components.Set(target, new Components.Pooled {
                    Reference = source
                });
            }
            return(cloned);
        }