Axiom.Core.Entity.Clone C# (CSharp) Метод

Clone() публичный Метод

public Clone ( string newName ) : Entity
newName string
Результат Entity
		public Entity Clone( string newName )
		{
			if ( Manager == null )
			{
				throw new AxiomException( "Cannot clone an Entity that wasn't created by a SceneManager." );
			}

			// create a new entity using the current mesh (uses same instance, not a copy for speed)
			Entity clone = this.Manager.CreateEntity( newName, this.mesh.Name );

			// loop through each subentity and set the material up for the clone
			for ( int i = 0; i < this.subEntityList.Count; i++ )
			{
				SubEntity subEntity = subEntityList[ i ];
				SubEntity cloneSubEntity = clone.GetSubEntity( i );
				cloneSubEntity.MaterialName = subEntity.MaterialName;
				cloneSubEntity.IsVisible = subEntity.IsVisible;
			}

			// copy the animation state as well
			if ( this.animationState != null )
			{
				clone.animationState = this.animationState.Clone();
			}

			return clone;
		}