public Particle[] LegacyScaleParticle(Particle[] parts, bool bScale, bool bPosUpdate)
    {
        float fScale;

        if (bScale)
        {
            fScale = NcTransformTool_B.GetTransformScaleMeanValue(transform);
        }
        else
        {
            fScale = 1 / NcTransformTool_B.GetTransformScaleMeanValue(transform);
        }

        for (int n = 0; n < parts.Length; n++)
        {
            if (IsMeshParticleEmitter() == false)
            {
                if (m_bWorldSpace)
                {
                    if (bPosUpdate)
                    {
                        Vector3 move = (m_OldPos - transform.position);
                        if (bScale)
                        {
                            parts[n].position -= move * (1 - 1 / fScale);
                        }
                    }
                    parts[n].position -= transform.position;
                    parts[n].position *= fScale;
                    parts[n].position += transform.position;
                }
                else
                {
                    parts[n].position *= fScale;
                }
            }
            parts[n].angularVelocity *= fScale;
            parts[n].velocity        *= fScale;
            parts[n].size            *= fScale;
        }
        return(parts);
    }
Пример #2
0
    public ParticleSystem.Particle[] ShurikenScaleParticle(ParticleSystem.Particle[] parts, int nCount, bool bScale, bool bPosUpdate)
    {
        float fScale;

        if (bScale)
        {
            fScale = NcTransformTool_B.GetTransformScaleMeanValue(transform);
        }
        else
        {
            fScale = 1 / NcTransformTool_B.GetTransformScaleMeanValue(transform);
        }

        for (int n = 0; n < nCount; n++)
        {
            if (m_bWorldSpace)
            {
                if (bPosUpdate)
                {
                    Vector3 move = (m_OldPos - transform.position);
                    if (bScale)
                    {
                        parts[n].position -= move * (1 - 1 / fScale);
                    }
                }
                parts[n].position -= transform.position;
                parts[n].position *= fScale;
                parts[n].position += transform.position;
            }
            else
            {
                parts[n].position *= fScale;
            }
            //          parts[n].angularVelocity *= fScale;
#pragma warning disable CS0618 // Type or member is obsolete
            parts[n].size *= fScale;
#pragma warning restore CS0618 // Type or member is obsolete
                               //           parts[n].velocity *= fScale;
        }
        return(parts);
    }
    void LegacySetParticle()
    {
        ParticleEmitter  pe = m_pe;
        ParticleAnimator pa = m_pa;
        ParticleRenderer pr = m_pr;

        if (pe == null || pr == null)
        {
            return;
        }

        if (m_bLegacyRuntimeScale)
        {
            Vector3 vecVelScale = Vector3.one * m_fStartSpeedRate;
            float   fVelScale   = m_fStartSpeedRate;

            pe.minSize     *= m_fStartSizeRate;
            pe.maxSize     *= m_fStartSizeRate;
            pe.minEnergy   *= m_fStartLifeTimeRate;
            pe.maxEnergy   *= m_fStartLifeTimeRate;
            pe.minEmission *= m_fStartEmissionRate;
            pe.maxEmission *= m_fStartEmissionRate;

            pe.worldVelocity         = Vector3.Scale(pe.worldVelocity, vecVelScale);
            pe.localVelocity         = Vector3.Scale(pe.localVelocity, vecVelScale);
            pe.rndVelocity           = Vector3.Scale(pe.rndVelocity, vecVelScale);
            pe.angularVelocity      *= fVelScale;
            pe.rndAngularVelocity   *= fVelScale;
            pe.emitterVelocityScale *= fVelScale;

//          NgAssembly.LogFieldsPropertis(pe);

            if (pa != null)
            {
                pa.rndForce = Vector3.Scale(pa.rndForce, vecVelScale);
                pa.force    = Vector3.Scale(pa.force, vecVelScale);
//				pa.damping					*= fScale;
            }

//          pr.velocityScale			*= fVelScale;
            pr.lengthScale *= m_fRenderLengthRate;
        }
        else
        {
            Vector3 vecVelScale = (m_bScaleWithTransform ? pe.transform.lossyScale : Vector3.one) * m_fStartSpeedRate;
            float   fVelScale   = (m_bScaleWithTransform ? NcTransformTool_B.GetTransformScaleMeanValue(pe.transform) : 1) * m_fStartSpeedRate;
            float   fScale      = (m_bScaleWithTransform ? NcTransformTool_B.GetTransformScaleMeanValue(pe.transform) : 1) * m_fStartSizeRate;

            pe.minSize     *= fScale;
            pe.maxSize     *= fScale;
            pe.minEnergy   *= m_fStartLifeTimeRate;
            pe.maxEnergy   *= m_fStartLifeTimeRate;
            pe.minEmission *= m_fStartEmissionRate;
            pe.maxEmission *= m_fStartEmissionRate;

            pe.worldVelocity         = Vector3.Scale(pe.worldVelocity, vecVelScale);
            pe.localVelocity         = Vector3.Scale(pe.localVelocity, vecVelScale);
            pe.rndVelocity           = Vector3.Scale(pe.rndVelocity, vecVelScale);
            pe.angularVelocity      *= fVelScale;
            pe.rndAngularVelocity   *= fVelScale;
            pe.emitterVelocityScale *= fVelScale;

//          NgAssembly.LogFieldsPropertis(pe);

            if (pa != null)
            {
                pa.rndForce = Vector3.Scale(pa.rndForce, vecVelScale);
                pa.force    = Vector3.Scale(pa.force, vecVelScale);
//				pa.damping					*= fScale;
            }

//          pr.velocityScale			*= fVelScale;
            pr.lengthScale *= m_fRenderLengthRate;
        }
    }
 public float GetScaleMaxMeshNormalVelocity()
 {
     return(m_fLegacyMaxMeshNormalVelocity * (m_bScaleWithTransform ? NcTransformTool_B.GetTransformScaleMeanValue(transform) : 1));
 }