/// <summary>
        /// Add random value to the effect's transform's scale.
        /// </summary>
        /// <param name="dae"> effect transform </param>
        private void AddRandomScale(JCS_ParticleSystem dae)
        {
            float   addScale;
            Vector3 newScale = dae.transform.localScale;

            addScale    = Random.Range(-mRandScaleRange, mRandScaleRange);
            newScale.x += addScale;

            addScale    = Random.Range(-mRandScaleRange, mRandScaleRange);
            newScale.y += addScale;

            // Not sure we have to include z direction?
            addScale    = Random.Range(-mRandScaleRange, mRandScaleRange);
            newScale.z += addScale;

            dae.transform.localScale = newScale;
        }
        /// <summary>
        /// Add random value to the effect's transform's rotation.
        /// </summary>
        /// <param name="dae"> effect transform </param>
        private void AddRandomRotation(JCS_ParticleSystem dae)
        {
            float   addRot;
            Vector3 newRot = dae.transform.localEulerAngles;

            addRot    = Random.Range(-mRandRotRange, mRandRotRange);
            newRot.x += addRot;

            addRot    = Random.Range(-mRandRotRange, mRandRotRange);
            newRot.y += addRot;

            // Not sure we have to include z direction?
            addRot    = Random.Range(-mRandRotRange, mRandRotRange);
            newRot.z += addRot;

            dae.transform.localEulerAngles = newRot;
        }
        //========================================
        //      Self-Define
        //------------------------------
        //----------------------
        // Public Functions

        //----------------------
        // Protected Functions

        //----------------------
        // Private Functions

        /// <summary>
        /// Add random value to the effect's transform's position.
        /// </summary>
        /// <param name="dae"> effect transform </param>
        private void AddRandomPosition(JCS_ParticleSystem dae)
        {
            float   addPos;
            Vector3 newPos = dae.transform.position;

            addPos    = Random.Range(-mRandPosRange, mRandPosRange);
            newPos.x += addPos;

            addPos    = Random.Range(-mRandPosRange, mRandPosRange);
            newPos.y += addPos;

            // Not sure we have to include z direction?
            addPos    = Random.Range(-mRandPosRange, mRandPosRange);
            newPos.z += addPos;

            dae.transform.position = newPos;
        }
        /* Setter & Getter */

        /* Functions */

        private void Awake()
        {
            this.mParticleSystem = this.GetComponent <JCS_ParticleSystem>();
        }
        private void OnDestroy()
        {
            // if is quitting the application don't spawn object,
            // or else will cause memory leak!
            if (JCS_ApplicationManager.APP_QUITTING)
            {
                return;
            }

            // if switching the scene, don't spawn new gameObject.
            if (JCS_SceneManager.instance.IsSwitchingScene())
            {
                return;
            }

            // trigger this effect?
            bool onTrigger = false;

            if (mActiveWhatever)
            {
                onTrigger = true;
            }
            // no need to check the rest.
            else
            {
                // if checking for hit list
                if (mActiveWithHitList)
                {
                    if (mHitList.IsHit)
                    {
                        onTrigger = true;
                    }
                }

                // if checking for destroy time.
                if (mActiveWithDestroyTime)
                {
                    if (mDestroyObjectWithTime != null)
                    {
                        if (mDestroyObjectWithTime.TimesUp)
                        {
                            onTrigger = true;
                        }
                    }
                    else
                    {
                        JCS_Debug.LogError(
                            "You active the destroy time but without the JCS_DestroyObjectWithTime component...");
                    }
                }
            }

            // do not trigger this effect.
            if (!onTrigger)
            {
                return;
            }


            GameObject gm = new GameObject();

#if (UNITY_EDITOR)
            gm.name = "JCS_DestroyParticleEffect";
#endif

            JCS_ParticleSystem jcsps = gm.AddComponent <JCS_ParticleSystem>();

            if (mSamePosition)
            {
                jcsps.transform.position = this.transform.position;
            }
            if (mSameRotation)
            {
                jcsps.transform.rotation = this.transform.rotation;
            }
            if (mSameScale)
            {
                jcsps.transform.localScale = this.transform.localScale;
            }

            // Random Effect
            if (mRandPos)
            {
                AddRandomPosition(jcsps);
            }
            if (mRandRot)
            {
                AddRandomRotation(jcsps);
            }
            if (mRandScale)
            {
                AddRandomScale(jcsps);
            }

            // copy and paste component to new one.
            {
                jcsps.Particle      = mParticleSystem.Particle;
                jcsps.NumOfParticle = mParticleSystem.NumOfParticle;

                jcsps.Active       = mParticleSystem.Active;
                jcsps.ActiveThread = mParticleSystem.ActiveThread;
                jcsps.OrderLayer   = mParticleSystem.OrderLayer;
                jcsps.Density      = mParticleSystem.Density;
                jcsps.WindSpeed    = mParticleSystem.WindSpeed;

                jcsps.AlwaysTheSameScale = mParticleSystem.AlwaysTheSameScale;

                jcsps.FreezeX = mParticleSystem.FreezeX;
                jcsps.FreezeY = mParticleSystem.FreezeY;
                jcsps.FreezeZ = mParticleSystem.FreezeZ;

                jcsps.RandPosX = mParticleSystem.RandPosX;
                jcsps.RandPosY = mParticleSystem.RandPosY;
                jcsps.RandPosZ = mParticleSystem.RandPosZ;

                jcsps.RandAngleX = mParticleSystem.RandAngleX;
                jcsps.RandAngleY = mParticleSystem.RandAngleY;
                jcsps.RandAngleZ = mParticleSystem.RandAngleZ;

                jcsps.RandScaleX = mParticleSystem.RandScaleX;
                jcsps.RandScaleY = mParticleSystem.RandScaleY;
                jcsps.RandScaleZ = mParticleSystem.RandScaleZ;

                jcsps.DoShotImmediately = mParticleSystem.DoShotImmediately;

                jcsps.SetChild = mParticleSystem.SetChild;
                jcsps.SetToSamePositionWhenActive = mParticleSystem.SetToSamePositionWhenActive;
            }

            // spawn the particle immediately.
            jcsps.SpawnParticles();

            // spawn the particle.
            jcsps.PlayOneShot();


            if (mDestroyByTime)
            {
                JCS_DestroyObjectWithTime dowt = gm.AddComponent <JCS_DestroyObjectWithTime>();
                dowt.DestroyTime = mDestroyTime;
            }
            else
            {
                // add destroy event.
                gm.AddComponent <JCS_DestroyParticleEndEvent>();
            }
        }
 //========================================
 //      Unity's function
 //------------------------------
 private void Awake()
 {
     this.mParticleSystem = this.GetComponent <JCS_ParticleSystem>();
     this.mHitList        = this.GetComponent <JCS_HitListEvent>();
 }