List <Vector4> GetParticlePostions(bool bPosUpdate)
    {
        List <Vector4> listPartis = new List <Vector4>();

        if (IsShuriken())
        {
            CreateTempObject();

            if (IsShuriken())
            {
                float fScale = 1.0f;
                ParticleSystem.Particle[] parts = new ParticleSystem.Particle[m_BaseTrans.GetComponent <ParticleSystem>().particleCount];
                m_BaseTrans.GetComponent <ParticleSystem>().GetParticles(parts);

                NcTransformTool.InitWorldTransform(m_CalcBaseTrans);
                if (m_bWorldParticle)
                {
                    NcParticleSystem ncPartScale = m_BaseTrans.GetComponent <NcParticleSystem>();
                    if (m_bScaledParticle)
                    {
                        ncPartScale.ShurikenScaleParticle(parts, parts.Length, true, bPosUpdate);
                    }
                }
                else
                {
                    m_CalcBaseTrans.position = m_BaseTrans.position;
                    m_CalcBaseTrans.rotation = m_BaseTrans.rotation;

                    if (m_bScaledParticle)
                    {
                        NcTransformTool.CopyLossyToLocalScale(NcTransformTool.GetTransformScaleMeanVector(m_BaseTrans), m_CalcBaseTrans);
                        fScale = NcTransformTool.GetTransformScaleMeanValue(m_BaseTrans);
                    }
                }

                foreach (ParticleSystem.Particle part in parts)
                {
                    Vector3 worldPos;
                    float   fSize = part.size * fScale;
                    NcTransformTool.InitLocalTransform(m_CalcChildTrans);
                    m_CalcChildTrans.localPosition = part.position;
                    worldPos = m_CalcChildTrans.position;

                    listPartis.Add(new Vector4(worldPos.x, worldPos.y, worldPos.z, fSize));
                }
            }
        }
        return(listPartis);
    }
Esempio n. 2
0
    List <Vector4> GetParticlePostions(bool bPosUpdate)
    {
        List <Vector4> listPartis = new List <Vector4>();

        if (IsLegacy() || IsShuriken())
        {
            CreateTempObject();

            if (IsShuriken())
            {
                float fScale = 1.0f;
                ParticleSystem.Particle[] parts = new ParticleSystem.Particle[m_BaseTrans.GetComponent <ParticleSystem>().particleCount];
                m_BaseTrans.GetComponent <ParticleSystem>().GetParticles(parts);

                NcTransformTool.InitWorldTransform(m_CalcBaseTrans);
                if (m_bWorldParticle)
                {
                    NcParticleSystem ncPartScale = m_BaseTrans.GetComponent <NcParticleSystem>();
                    if (m_bScaledParticle)
                    {
                        ncPartScale.ShurikenScaleParticle(parts, parts.Length, true, bPosUpdate);
                    }
                }
                else
                {
                    m_CalcBaseTrans.position = m_BaseTrans.position;
                    m_CalcBaseTrans.rotation = m_BaseTrans.rotation;

                    if (m_bScaledParticle)
                    {
                        NcTransformTool.CopyLossyToLocalScale(NcTransformTool.GetTransformScaleMeanVector(m_BaseTrans), m_CalcBaseTrans);
                        fScale = NcTransformTool.GetTransformScaleMeanValue(m_BaseTrans);
                    }
                }

                foreach (ParticleSystem.Particle part in parts)
                {
                    Vector3 worldPos;
                    float   fSize = part.size * fScale;
                    NcTransformTool.InitLocalTransform(m_CalcChildTrans);
                    m_CalcChildTrans.localPosition = part.position;
                    worldPos = m_CalcChildTrans.position;

                    listPartis.Add(new Vector4(worldPos.x, worldPos.y, worldPos.z, fSize));
                }
            }
            else
            {
                float fScale = 1.0f;
                //Particle[]	parts = m_BaseTrans.GetComponent<ParticleEmitter>().particles;

                NcTransformTool.InitWorldTransform(m_CalcBaseTrans);
                if (m_bWorldParticle)
                {
                    // m_bLegacyRuntimeScale
                    //NcParticleSystem ncPartScale = m_BaseTrans.GetComponent<NcParticleSystem>();
                    //if (m_bScaledParticle)
                    //	ncPartScale.LegacyScaleParticle(parts, true, bPosUpdate);
                }
                else
                {
                    m_CalcBaseTrans.position = m_BaseTrans.position;
                    m_CalcBaseTrans.rotation = m_BaseTrans.rotation;

                    // m_bLegacyRuntimeScale
                    NcParticleSystem ncPartScale = m_BaseTrans.GetComponent <NcParticleSystem>();
                    if (m_bScaledParticle && ncPartScale.IsMeshParticleEmitter() == false)
                    {
                        NcTransformTool.CopyLossyToLocalScale(NcTransformTool.GetTransformScaleMeanVector(m_BaseTrans), m_CalcBaseTrans);
                        fScale = NcTransformTool.GetTransformScaleMeanValue(m_BaseTrans);
                    }
                    else
                    {
                        fScale = NcTransformTool.GetTransformScaleMeanValue(m_BaseTrans);
                    }
                }

//				foreach (Particle part in parts)
//				{
//					if (System.Single.IsNaN(part.position.x))
//						continue;
//					Vector3 worldPos;
////					float	fSize	= part.size;
//					float	fSize	= part.size * fScale;		// m_bLegacyRuntimeScale
//					NcTransformTool.InitLocalTransform(m_CalcChildTrans);
//					m_CalcChildTrans.localPosition = part.position;
//					worldPos = m_CalcChildTrans.position;
//					listPartis.Add(new Vector4(worldPos.x, worldPos.y, worldPos.z, fSize));
//				}
            }
        }
        return(listPartis);
    }