Example #1
0
    /// <summary>
    /// This function is used to help set basic properties on a particle emitter
    /// in a generic way.
    /// </summary>
    /// <param name="emitter">The particle emitter whose properties are to be set.</param>
    /// <param name="targetProperty">The target property to set.</param>
    /// <param name="propertyValue">The value to set the target property to.</param>
    public static void SetEmitterProperty(ParticleEmitter emitter, EmitterProperty targetProperty, float propertyValue)
    {
        //check if the emitter is null
        if (emitter == null)
        {
            return;
        }

        //set the property
        switch (targetProperty)
        {
        case EmitterProperty.AngularVelocity:
            emitter.angularVelocity = propertyValue;
            break;

        case EmitterProperty.RandomAngularVelocity:
            emitter.rndAngularVelocity = propertyValue;
            break;

        case EmitterProperty.EmitterVelocityScale:
            emitter.emitterVelocityScale = propertyValue;
            break;

        case EmitterProperty.MinSize:
            emitter.minSize = propertyValue;
            break;

        case EmitterProperty.MaxSize:
            emitter.maxSize = propertyValue;
            break;

        case EmitterProperty.MinEnergy:
            emitter.minEnergy = propertyValue;
            break;

        case EmitterProperty.MaxEnergy:
            emitter.maxEnergy = propertyValue;
            break;

        case EmitterProperty.MinEmission:
            emitter.minEmission = propertyValue;
            break;

        case EmitterProperty.MaxEmission:
            emitter.maxEmission = propertyValue;
            break;

        default:
            break;
        }
    }
    /// <summary>
    /// This is callled when this commponent is reset.
    /// </summary>
    public override void Reset()
    {
        base.Reset();

        targetProperty = Defaults.targetProperty;
    }
    /// <summary>
    /// This function is used to help set basic properties on a particle emitter
    /// in a generic way.
    /// </summary>
    /// <param name="emitter">The particle emitter whose properties are to be set.</param>
    /// <param name="targetProperty">The target property to set.</param>
    /// <param name="propertyValue">The value to set the target property to.</param>
	public static void SetEmitterProperty(ParticleEmitter emitter, EmitterProperty targetProperty, float propertyValue)
	{
		//check if the emitter is null
		if (emitter == null)
		{
			return;
		}
		
        //set the property
        switch (targetProperty)
        {
            case EmitterProperty.AngularVelocity:
                emitter.angularVelocity = propertyValue;
                break;
            case EmitterProperty.RandomAngularVelocity:
                emitter.rndAngularVelocity = propertyValue;
                break;
            case EmitterProperty.EmitterVelocityScale:
                emitter.emitterVelocityScale = propertyValue;
                break;
            case EmitterProperty.MinSize:
                emitter.minSize = propertyValue;
                break;
            case EmitterProperty.MaxSize:
                emitter.maxSize = propertyValue;
                break;
            case EmitterProperty.MinEnergy:
                emitter.minEnergy = propertyValue;
                break;
            case EmitterProperty.MaxEnergy:
                emitter.maxEnergy = propertyValue;
                break;
            case EmitterProperty.MinEmission:
                emitter.minEmission = propertyValue;
                break;
            case EmitterProperty.MaxEmission:
                emitter.maxEmission = propertyValue;
                break;
            default:
                break;
        }
    }
    /// <summary>
    /// This is callled when this commponent is reset. 
    /// </summary>
    public override void Reset()
    {
        base.Reset();

        targetProperty = Defaults.targetProperty;
    }