SetParam() public méthode

public SetParam ( string name, string val ) : bool
name string
val string
Résultat bool
        /// <summary>
        ///
        /// </summary>
        /// <param name="line"></param>
        /// <param name="emitter"></param>
        private void ParseEmitterAttrib(string line, ParticleEmitter emitter)
        {
            string[] values = line.Split(new char[] { ' ' }, 2);

            if (!(emitter.SetParam(values[0], values[1])))
            {
                ParseHelper.LogParserError(values[0], emitter.Type, "Command not found.");
            }
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="emitter"></param>
        public virtual void CopyTo(ParticleEmitter emitter)
        {
            // loop through all registered commands and copy from this instance to the target instance
            foreach (var key in this.commandTable.Keys)
            {
                // get the value of the param from this instance
                var val = ((IPropertyCommand)this.commandTable[key]).Get(this);

                // set the param on the target instance
                emitter.SetParam(key, val);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="emitter"></param>
        public virtual void CopyTo(ParticleEmitter emitter)
        {
            // loop through all registered commands and copy from this instance to the target instance
            foreach (DictionaryEntry entry in commandTable)
            {
                string name = (string)entry.Key;

                // get the value of the param from this instance
                string val = ((ICommand)entry.Value).Get(this);

                // set the param on the target instance
                emitter.SetParam(name, val);
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="emitter"></param>
        public virtual void CopyTo(ParticleEmitter emitter)
        {
            // loop through all registered commands and copy from this instance to the target instance
            foreach(DictionaryEntry entry in commandTable) {
                string name = (string)entry.Key;

                // get the value of the param from this instance
                string val = ((ICommand)entry.Value).Get(this);

                // set the param on the target instance
                emitter.SetParam(name, val);
            }
        }
Exemple #5
0
		/// <summary>
		///
		/// </summary>
		/// <param name="emitter"></param>
		public virtual void CopyTo( ParticleEmitter emitter )
		{
			// loop through all registered commands and copy from this instance to the target instance
			foreach ( string key in commandTable.Keys )
			{
				// get the value of the param from this instance
				string val = ( (IPropertyCommand)commandTable[ key ] ).Get( this );

				// set the param on the target instance
				emitter.SetParam( key, val );
			}
		}
        /// <summary>
        /// 
        /// </summary>
        /// <param name="line"></param>
        /// <param name="emitter"></param>
        private void ParseEmitterAttrib(string line, ParticleEmitter emitter)
        {
            string[] values = line.Split(new char[] {' '}, 2);

            if(!(emitter.SetParam(values[0], values[1]))) {
                ParseHelper.LogParserError(values[0], emitter.Type, "Command not found.");
            }
        }
			/// <see cref="Translator.Translate"/>
			public override void Translate( ScriptCompiler compiler, AbstractNode node )
			{
				ObjectAbstractNode obj = (ObjectAbstractNode)node;

				// Must have a type as the first value
				if ( obj.Values.Count == 0 )
				{
					compiler.AddError( CompileErrorCode.StringExpected, obj.File, obj.Line );
					return;
				}

				string type = string.Empty;
				if ( !getString( obj.Values[ 0 ], out type ) )
				{
					compiler.AddError( CompileErrorCode.InvalidParameters, obj.File, obj.Line );
					return;
				}

				ParticleSystem system = (ParticleSystem)obj.Parent.Context;
				_Emitter = system.AddEmitter( type );

				foreach ( AbstractNode i in obj.Children )
				{
					if ( i is PropertyAbstractNode )
					{
						PropertyAbstractNode prop = (PropertyAbstractNode)i;
						string value = string.Empty;

						// Glob the values together
						foreach ( AbstractNode it in prop.Values )
						{
							if ( it is AtomAbstractNode )
							{
								if ( string.IsNullOrEmpty( value ) )
									value = ( (AtomAbstractNode)it ).Value;
								else
									value = value + " " + ( (AtomAbstractNode)it ).Value;
							}
							else
							{
								compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line );
								break;
							}
						}

						if ( !_Emitter.SetParam( prop.Name, value ) )
						{
							compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line );
						}
					}
					else
					{
						_processNode( compiler, i );
					}
				}
			}