public void CopyTo( TextureUnitState target )
{
FieldInfo[] props = target.GetType().GetFields( BindingFlags.NonPublic | BindingFlags.Instance );
// save parent from target, since it will be overwritten by the following loop
Pass tmpParent = target.parent;
for ( int i = 0; i < props.Length; i++ )
{
FieldInfo prop = props[ i ];
object srcVal = prop.GetValue( this );
prop.SetValue( target, srcVal );
}
// restore correct parent
target.parent = tmpParent;
target.frames = new string[ MaxAnimationFrames ];
// copy over animation frame texture names
for ( int i = 0; i < MaxAnimationFrames; i++ )
{
target.frames[ i ] = frames[ i ];
}
// must clone these references
target.colorBlendMode = colorBlendMode.Clone();
target.alphaBlendMode = alphaBlendMode.Clone();
target.effectList = new TextureEffectList();
// copy effects
foreach ( TextureEffect effect in effectList )
{
target.effectList.Add( effect.Clone() );
}
// dirty the hash of the parent pass
target.parent.DirtyHash();
}