Nez.Portable/ECS/Entity.cs
/// <summary>
/// copies the properties, components and colliders of Entity to this instance
/// </summary>
/// <param name="entity">Entity.</param>
copies the properties, components and colliders of Entity to this instance
copies the properties components and colliders of Entity to this instance
protected void copyFrom(Entity entity)
        {
            tag = entity.tag;
            updateInterval = entity.updateInterval;
            updateOrder = entity.updateOrder;
            enabled = entity.enabled;
            transform.scale = entity.transform.scale;
            transform.rotation = entity.transform.rotation;
            for (var i = 0; i < entity.components.count; i++)
                addComponent(entity.components[i].clone());
            for (var i = 0; i < entity.components._componentsToAdd.Count; i++)
                addComponent(entity.components._componentsToAdd[i].clone());
            for (var i = 0; i < entity.transform.childCount; i++)
            {
                var child = entity.transform.getChild(i).entity;
                var childClone = child.clone();
                childClone.transform.copyFrom(child.transform);
                childClone.transform.parent = transform;
            }
        }
protected void copyFrom ( Entity entity ) { tag = entity . tag ; updateInterval = entity . updateInterval ; updateOrder = entity . updateOrder ; enabled = entity . enabled ; transform . scale = entity . transform . scale ; transform . rotation = entity . transform . rotation ; for ( var i = 0 ; i < entity . components . count ; i ++ ) addComponent ( entity . components [ i ] . clone ( ) ) ; for ( var i = 0 ; i < entity . components . _componentsToAdd . Count ; i ++ ) addComponent ( entity . components . _componentsToAdd [ i ] . clone ( ) ) ; for ( var i = 0 ; i < entity . transform . childCount ; i ++ ) { var child = entity . transform . getChild ( i ) . entity ; var childClone = child . clone ( ) ; childClone . transform . copyFrom ( child . transform ) ; childClone . transform . parent = transform ; } }
copies the properties, components and colliders of Entity to this instance
copies the properties components and colliders of Entity to this instance
// Entity fields // clone Components // clone any children of the Entity.transform
entity
Entity
None