Example #1
0
        public ParticleSystemCurveMode GetCurveMode()
        {
            ParticleSystemCurveMode psCurveMode = new ParticleSystemCurveMode();

            switch (mode)
            {
            case "Constant":
            {
                psCurveMode = ParticleSystemCurveMode.Constant;
                break;
            }

            case "Curve":
            {
                psCurveMode = ParticleSystemCurveMode.Curve;
                break;
            }

            case "TwoConstants":
            {
                psCurveMode = ParticleSystemCurveMode.TwoConstants;
                break;
            }

            case "TwoCurves":
            {
                psCurveMode = ParticleSystemCurveMode.TwoCurves;
                break;
            }
            }

            return(psCurveMode);
        }
 public static void ParticleEmissionSettings(this ParticleSystem PS,
                                             bool enabled      = true,
                                             float scalar      = 0.0f,
                                             bool RateOverTime = false,
                                             bool Burst        = false,
                                             ParticleSystem.Burst[] BurstSettings = null, // Set Externally
                                             AnimationCurve animationCurve        = null, // Set Externally
                                             ParticleSystemCurveMode CurveMode    = ParticleSystemCurveMode.Constant,
                                             int rate = 0
                                             )
 {
     ParticleSystem.MinMaxCurve    EmissionCurve;
     ParticleSystem.EmissionModule emissionModule = PS.emission;
     // Emission Settings
     emissionModule.enabled = enabled;
     if (RateOverTime)
     {
         EmissionCurve               = new ParticleSystem.MinMaxCurve(scalar, animationCurve);
         EmissionCurve.mode          = CurveMode;
         emissionModule.rateOverTime = EmissionCurve;
     }
     if (Burst)
     {
         emissionModule.SetBursts(BurstSettings);
     }
     emissionModule.rateOverTime = rate;
 }
Example #3
0
        public MinMaxCurve(ParticleSystemCurveMode mode, float minValue, float maxValue, float minCurve, float maxCurve)
        {
            MinMaxState = mode;
            MinScalar   = minValue;
            Scalar      = maxValue;

            MinCurve = new AnimationCurveTpl <Float>(minCurve, 1.0f / 3.0f);
            MaxCurve = new AnimationCurveTpl <Float>(maxCurve, 1.0f / 3.0f);
        }
Example #4
0
            private float                   m_ConstantMax;     // 0x1C

            // Constructors
            public MinMaxCurve(float constant)
            {
                m_Mode            = default;
                m_CurveMultiplier = default;
                m_CurveMin        = default;
                m_CurveMax        = default;
                m_ConstantMin     = default;
                m_ConstantMax     = default;
            }             // 0x000000018004E720-0x000000018004E770
Example #5
0
        public MinMaxCurve(ParticleSystemCurveMode mode, float minValue, float maxValue, float minCurve, float maxCurve)
        {
            MinMaxState = mode;
            MinScalar   = minValue;
            Scalar      = maxValue;

            MinCurve = new AnimationCurveTpl <Float>(minCurve, KeyframeTpl <Float> .DefaultFloatWeight);
            MaxCurve = new AnimationCurveTpl <Float>(maxCurve, KeyframeTpl <Float> .DefaultFloatWeight);
        }
Example #6
0
 public YoooMinMaxCurve(ParticleSystem.MinMaxCurve curve)
 {
     Data        = curve;
     constantMax = Data.constantMax;
     constantMin = Data.constantMin;
     curveMax    = Data.curveMax;
     curveMin    = Data.curveMin;
     curveScalar = Data.curveScalar;
     mode        = Data.mode;
 }
        public override void Reset()
        {
            gameObject = null;
            mode       = ParticleSystemCurveMode.Constant;

            startSize    = null;
            minStartSize = null;
            maxStartSize = null;

            everyFrame = false;
        }
 protected override void ReadFromImpl(object obj)
 {
     base.ReadFromImpl(obj);
     ParticleSystem.MinMaxCurve uo = (ParticleSystem.MinMaxCurve)obj;
     mode            = uo.mode;
     curveMultiplier = uo.curveMultiplier;
     curveMax        = uo.curveMax;
     curveMin        = uo.curveMin;
     constantMax     = uo.constantMax;
     constantMin     = uo.constantMin;
     constant        = uo.constant;
     curve           = uo.curve;
 }
    public void SetParticleSystem(ParticleSystem ps)
    {
        if (ps != this.particleSystem)
        {
            this.mDuration    = 0;
            this.mRunningTime = 0;
            this.mbPlaying    = false;
            if (ps)
            {
                this.particleSystem = ps;
                this.mDuration      = ps.main.duration;
                this.mLoop          = ps.main.loop;

                if (this.mLoop == false)
                {
                    ParticleSystemCurveMode mode = ps.main.startLifetime.mode;
                    if (mode == ParticleSystemCurveMode.Constant)
                    {
                        this.mDuration += ps.main.startLifetime.constant;
                    }
                    else if (mode == ParticleSystemCurveMode.TwoConstants)
                    {
                        this.mDuration += ps.main.startLifetime.constantMax;
                    }
                    else
                    {
                        this.mDuration += 2;
                    }

                    mode = ps.main.startDelay.mode;
                    if (mode == ParticleSystemCurveMode.Constant)
                    {
                        this.mDuration += ps.main.startDelay.constant;
                    }
                    else if (mode == ParticleSystemCurveMode.TwoConstants)
                    {
                        this.mDuration += ps.main.startDelay.constantMax;
                    }
                    else
                    {
                        this.mDuration += 2;
                    }
                }
            }
        }
    }
 public static void ParticleRotationSettings(this ParticleSystem PS,
                                             bool enabled   = true,
                                             float Scalar   = 1.0f,
                                             float Velocity = 100f,
                                             ParticleSystemCurveMode curveMode = ParticleSystemCurveMode.Constant,
                                             float CurveMin = 45f,
                                             float CurveMax = 114f
                                             )
 {
     ParticleSystem.RotationOverLifetimeModule rotationOverLifetimeModule = PS.rotationOverLifetime;
     // Rotation settings
     rotationOverLifetimeModule.enabled = enabled;
     if (curveMode == ParticleSystemCurveMode.Constant)
     {
         ParticleSystem.MinMaxCurve RotationCurveConst = new ParticleSystem.MinMaxCurve(Velocity);
         RotationCurveConst.mode      = curveMode;
         rotationOverLifetimeModule.z = RotationCurveConst;
     }
     if (curveMode == ParticleSystemCurveMode.TwoConstants)
     {
         rotationOverLifetimeModule.z = new ParticleSystem.MinMaxCurve(1f, 3f);
     }
 }
Example #11
0
 public SerializablePSCurveMode(ParticleSystemCurveMode psCurveMode)
 {
     mode = psCurveMode.ToString();
 }
 /// <summary>
 ///   <para>Randomly select values based on the interval between the minimum and maximum constants.</para>
 /// </summary>
 /// <param name="min">The constant describing the minimum values to be evaluated.</param>
 /// <param name="max">The constant describing the maximum values to be evaluated.</param>
 public MinMaxCurve(float min, float max)
 {
   this.m_Mode = ParticleSystemCurveMode.TwoConstants;
   this.m_CurveScalar = 0.0f;
   this.m_CurveMin = (AnimationCurve) null;
   this.m_CurveMax = (AnimationCurve) null;
   this.m_ConstantMin = min;
   this.m_ConstantMax = max;
 }
 /// <summary>
 ///   <para>Randomly select values based on the interval between the minimum and maximum curves.</para>
 /// </summary>
 /// <param name="scalar">A multiplier to be applied to the curves.</param>
 /// <param name="min">The curve describing the minimum values to be evaluated.</param>
 /// <param name="max">The curve describing the maximum values to be evaluated.</param>
 public MinMaxCurve(float scalar, AnimationCurve min, AnimationCurve max)
 {
   this.m_Mode = ParticleSystemCurveMode.TwoCurves;
   this.m_CurveScalar = scalar;
   this.m_CurveMin = min;
   this.m_CurveMax = max;
   this.m_ConstantMin = 0.0f;
   this.m_ConstantMax = 0.0f;
 }
 /// <summary>
 ///   <para>Use one curve when evaluating numbers along this Min-Max curve.</para>
 /// </summary>
 /// <param name="scalar">A multiplier to be applied to the curve.</param>
 /// <param name="curve">A single curve for evaluating against.</param>
 public MinMaxCurve(float scalar, AnimationCurve curve)
 {
   this.m_Mode = ParticleSystemCurveMode.Curve;
   this.m_CurveScalar = scalar;
   this.m_CurveMin = (AnimationCurve) null;
   this.m_CurveMax = curve;
   this.m_ConstantMin = 0.0f;
   this.m_ConstantMax = 0.0f;
 }
 /// <summary>
 ///   <para>A single constant value for the entire curve.</para>
 /// </summary>
 /// <param name="constant">Constant value.</param>
 public MinMaxCurve(float constant)
 {
   this.m_Mode = ParticleSystemCurveMode.Constant;
   this.m_CurveScalar = 0.0f;
   this.m_CurveMin = (AnimationCurve) null;
   this.m_CurveMax = (AnimationCurve) null;
   this.m_ConstantMin = 0.0f;
   this.m_ConstantMax = constant;
 }
Example #16
0
 private bool ValidateMode(ParticleSystemCurveMode mode)
 {
     return(mode == ParticleSystemCurveMode.Constant);
 }