示例#1
0
文件: ZEntity.cs 项目: zzh-527/ZECS
        /// <summary>
        /// Clone this instance.
        /// </summary>
        public ZEntity Clone()
        {
            ZEntity newEntity = new ZEntity();

            newEntity.Name = Name;
            newEntity.ID   = ID;

            foreach (var e in components)
            {
                var newCom = EntityPoolRuntimeBuildUtils.CloneObject(e);
                if (newCom != null)
                {
                    newEntity.AddComponent((IZComponent)newCom);
                }
            }

            return(newEntity);
        }
示例#2
0
        /// <summary>
        /// Clone the specified en.
        /// </summary>
        /// <param name="en">En.</param>
        public ZEntity Clone(ZEntity en)
        {
            ZEntity newEntity = (ZEntity)EntityPoolRuntimeBuildUtils.CloneObject((object)en);

            return(newEntity);
        }