protected static bool ParseWaveXForm( string parameters, MaterialScriptContext context )
{
string[] values = parameters.Split( new char[] { ' ', '\t' } );
if ( values.Length != 6 )
{
LogParseError( context, "Bad wave_xform attribute, wrong number of parameters (expected 6)." );
return false;
}
TextureTransform transType = 0;
WaveformType waveType = 0;
// check the transform type
object val = ScriptEnumAttribute.Lookup( values[ 0 ], typeof( TextureTransform ) );
if ( val == null )
{
string legalValues = ScriptEnumAttribute.GetLegalValues( typeof( TextureTransform ) );
LogParseError( context, "Bad wave_xform attribute, valid transform type values are {0}.", legalValues );
return false;
}
transType = (TextureTransform)val;
// check the wavetype
val = ScriptEnumAttribute.Lookup( values[ 1 ], typeof( WaveformType ) );
if ( val == null )
{
string legalValues = ScriptEnumAttribute.GetLegalValues( typeof( WaveformType ) );
LogParseError( context, "Bad wave_xform attribute, valid waveform type values are {0}.", legalValues );
return false;
}
waveType = (WaveformType)val;
// set the transform animation
context.textureUnit.SetTransformAnimation(
transType,
waveType,
StringConverter.ParseFloat( values[ 2 ] ),
StringConverter.ParseFloat( values[ 3 ] ),
StringConverter.ParseFloat( values[ 4 ] ),
StringConverter.ParseFloat( values[ 5 ] ) );
return false;
}