示例#1
0
    protected bool IsParticleEmitterOneShot(ParticleEmitter pe)
    {
        NcParticleSystem ps       = pe.GetComponent <NcParticleSystem>();
        bool             bOneShot = (bool)NgSerialized.GetPropertyValue(new SerializedObject(pe as ParticleEmitter), "m_OneShot");

        return(bOneShot && (ps == null || ps.m_bBurst == false));
    }
    public void OnAutoInitValue()
    {
        NcEffectBehaviour[] oriComs = m_OriginalTrans.GetComponents <NcEffectBehaviour>();
        foreach (NcEffectBehaviour effect in oriComs)
        {
            effect.OnUpdateToolData();
        }
        NcEffectBehaviour[] insComs = transform.GetComponents <NcEffectBehaviour>();
        foreach (NcEffectBehaviour effect in insComs)
        {
            effect.OnUpdateToolData();
        }

        // Set particleSystem.speed
//      {
//          NcParticleSystem	ncParticleScaleOri	= (m_OriginalTrans.GetComponent<NcParticleSystem>());
//          NcParticleSystem	ncParticleScaleIns	= (transform.GetComponent<NcParticleSystem>());
//          if (ncParticleScaleOri != null && ncParticleScaleIns != null && ncParticleScaleOri.GetComponent<ParticleSystem>() != null)
//          {
//              ncParticleScaleOri.SaveShurikenSpeed();
//              ncParticleScaleIns.SaveShurikenSpeed();
//          }
//      }

        // Update bWorldSpace
        {
            NcParticleSystem ncParticleScaleOri = (m_OriginalTrans.GetComponent <NcParticleSystem>());
            NcParticleSystem ncParticleScaleIns = (transform.GetComponent <NcParticleSystem>());
            if (ncParticleScaleOri != null && ncParticleScaleIns != null)
            {
                ncParticleScaleIns.m_bWorldSpace = ncParticleScaleOri.m_bWorldSpace = NgSerialized.GetSimulationSpaceWorld(ncParticleScaleOri.transform);
            }
        }
    }
示例#3
0
    // Property -------------------------------------------------------------------------
    // Loop Function --------------------------------------------------------------------
    // Control Function -----------------------------------------------------------------
    // Particle
    public GameObject GetSharedParticleGameObject(GameObject originalParticlePrefab)
    {
        int nIndex = m_SharedPrefabs.IndexOf(originalParticlePrefab);

        if (nIndex < 0 || m_SharedGameObjects[nIndex] == null)
        {
            if (!NcEffectBehaviour.IsSafe())
            {
                return(null);
            }
            GameObject sharedObj = Instantiate(originalParticlePrefab);
            sharedObj.transform.parent = NcEffectBehaviour.GetRootInstanceEffect().transform;
            if (0 <= nIndex)
            {
                m_SharedGameObjects[nIndex] = sharedObj;
            }
            else
            {
                m_SharedPrefabs.Add(originalParticlePrefab);
                m_SharedGameObjects.Add(sharedObj);
            }

            // Init sharedObj
            NcParticleSystem ps = sharedObj.GetComponent <NcParticleSystem>();
            if (ps)
            {
                ps.enabled = false;
            }
            if (sharedObj.GetComponent <ParticleEmitter>())
            {
                sharedObj.GetComponent <ParticleEmitter>().emit          = false;
                sharedObj.GetComponent <ParticleEmitter>().useWorldSpace = true;
                ParticleAnimator paAni = sharedObj.GetComponent <ParticleAnimator>();
                if (paAni)
                {
                    paAni.autodestruct = false;
                }
            }

            NcParticleSystem ncPsCom = sharedObj.GetComponent <NcParticleSystem>();
            if (ncPsCom)
            {
                ncPsCom.m_bBurst = false;
            }
            ParticleSystem psCom = sharedObj.GetComponent <ParticleSystem>();
            if (psCom)
            {
                psCom.enableEmission = false;
            }

            return(sharedObj);
        }
        else
        {
            return(m_SharedGameObjects[nIndex]);
        }
    }
示例#4
0
    public GameObject GetSharedParticleGameObject(GameObject originalParticlePrefab)
    {
        int num = this.m_SharedPrefabs.IndexOf(originalParticlePrefab);

        if (num >= 0 && !(this.m_SharedGameObjects[num] == null))
        {
            return(this.m_SharedGameObjects[num]);
        }
        if (!NcEffectBehaviour.IsSafe())
        {
            return(null);
        }
        GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(originalParticlePrefab);

        gameObject.transform.parent = NcEffectBehaviour.GetRootInstanceEffect().transform;
        if (0 <= num)
        {
            this.m_SharedGameObjects[num] = gameObject;
        }
        else
        {
            this.m_SharedPrefabs.Add(originalParticlePrefab);
            this.m_SharedGameObjects.Add(gameObject);
        }
        NcParticleSystem component = gameObject.GetComponent <NcParticleSystem>();

        if (component)
        {
            component.enabled = false;
        }
        if (gameObject.particleEmitter)
        {
            gameObject.particleEmitter.emit          = false;
            gameObject.particleEmitter.useWorldSpace = true;
            ParticleAnimator component2 = gameObject.GetComponent <ParticleAnimator>();
            if (component2)
            {
                component2.autodestruct = false;
            }
        }
        NcParticleSystem component3 = gameObject.GetComponent <NcParticleSystem>();

        if (component3)
        {
            component3.m_bBurst = false;
        }
        ParticleSystem component4 = gameObject.GetComponent <ParticleSystem>();

        if (component4)
        {
            component4.enableEmission = false;
        }
        return(gameObject);
    }
示例#5
0
    // Control --------------------------------------------------------------------------
    public void InitWireframe(Transform srcTrans)
    {
        m_BaseTrans = srcTrans;
        NcParticleSystem ncPartScale = m_BaseTrans.GetComponent <NcParticleSystem>();

        m_bScaledParticle = (ncPartScale != null && ncPartScale.enabled && ncPartScale.m_bScaleWithTransform);

//      m_meshRenderer = GetComponent<MeshRenderer>();
//      if (!m_meshRenderer)
//          m_meshRenderer = gameObject.AddComponent<MeshRenderer>();
    }
    public void OnAutoInitValue()
    {
        NcEffectBehaviour[] oriComs = m_OriginalTrans.GetComponents <NcEffectBehaviour>();
        foreach (NcEffectBehaviour effect in oriComs)
        {
            effect.OnUpdateToolData();
        }
        NcEffectBehaviour[] insComs = transform.GetComponents <NcEffectBehaviour>();
        foreach (NcEffectBehaviour effect in insComs)
        {
            effect.OnUpdateToolData();
        }

        // Set particleSystem.speed
//      {
//          NcParticleSystem	ncParticleScaleOri	= (m_OriginalTrans.GetComponent<NcParticleSystem>());
//          NcParticleSystem	ncParticleScaleIns	= (transform.GetComponent<NcParticleSystem>());
//          if (ncParticleScaleOri != null && ncParticleScaleIns != null && ncParticleScaleOri.particleSystem != null)
//          {
//              ncParticleScaleOri.SaveShurikenSpeed();
//              ncParticleScaleIns.SaveShurikenSpeed();
//          }
//      }

        // Update bWorldSpace
        {
            NcParticleSystem ncParticleScaleOri = (m_OriginalTrans.GetComponent <NcParticleSystem>());
            NcParticleSystem ncParticleScaleIns = (transform.GetComponent <NcParticleSystem>());
            if (ncParticleScaleOri != null && ncParticleScaleIns != null)
            {
                ncParticleScaleIns.m_bWorldSpace = ncParticleScaleOri.m_bWorldSpace = NgSerialized.GetSimulationSpaceWorld(ncParticleScaleOri.transform);
            }
        }

        // Set particleEmitter.m_MinNormalVelocity, m_MaxNormalVelocity
        {
            NcParticleSystem ncParticleScaleOri = (m_OriginalTrans.GetComponent <NcParticleSystem>());
            NcParticleSystem ncParticleScaleIns = (transform.GetComponent <NcParticleSystem>());
            if (ncParticleScaleOri != null && ncParticleScaleOri.enabled && ncParticleScaleIns != null && ncParticleScaleOri.GetComponent <ParticleEmitter>() != null && ncParticleScaleOri.m_bScaleWithTransform && NgSerialized.IsMeshParticleEmitter(ncParticleScaleOri.GetComponent <ParticleEmitter>()))
            {
                float fSetMinValue;
                float fSetMaxValue;
                NgSerialized.GetMeshNormalVelocity(ncParticleScaleOri.GetComponent <ParticleEmitter>(), out fSetMinValue, out fSetMaxValue);
                if (fSetMinValue != ncParticleScaleOri.GetScaleMinMeshNormalVelocity() || fSetMaxValue != ncParticleScaleOri.GetScaleMaxMeshNormalVelocity())
                {
                    NgSerialized.SetMeshNormalVelocity(ncParticleScaleOri.GetComponent <ParticleEmitter>(), ncParticleScaleOri.GetScaleMinMeshNormalVelocity(), ncParticleScaleOri.GetScaleMaxMeshNormalVelocity());
                    NgSerialized.SetMeshNormalVelocity(ncParticleScaleIns.GetComponent <ParticleEmitter>(), ncParticleScaleOri.GetScaleMinMeshNormalVelocity(), ncParticleScaleOri.GetScaleMaxMeshNormalVelocity());
                }
            }
        }
    }
    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);
    }
示例#8
0
 private void ShurikenInitParticle()
 {
     if (this.m_ps != null)
     {
         this.m_ps.startSize     *= this.m_fStartSizeRate;
         this.m_ps.startLifetime *= this.m_fStartLifeTimeRate;
         this.m_ps.emissionRate  *= this.m_fStartEmissionRate;
         this.m_ps.startSpeed    *= this.m_fStartSpeedRate;
         ParticleSystemRenderer component = base.GetComponent <ParticleSystemRenderer>();
         if (component != null)
         {
             float num = (float)NcParticleSystem.Ng_GetProperty(component, "lengthScale");
             NcParticleSystem.Ng_SetProperty(component, "lengthScale", num * this.m_fRenderLengthRate);
         }
     }
 }
示例#9
0
    bool CheckNotSupportComponent(GameObject targetObj, System.Type comType)
    {
        FxmInfoIndexing infoIndexingCom = null;
        Component       findCom;
        string          comName = "";

        findCom = NsEffectManager.GetComponentInChildren(targetObj, comType);
        if (findCom != null)
        {
            string subString = "UnityEngine.";
            comName = findCom.ToString();
            if (comName.Contains(subString))
            {
                comName = comName.Replace(subString, "");
            }
            infoIndexingCom = findCom.GetComponent <FxmInfoIndexing>();
        }

        if (findCom is ParticleEmitter)
        {
            if (IsParticleEmitterOneShot(findCom as ParticleEmitter))
            {
                if (infoIndexingCom != null)
                {
                    NcParticleSystem ncParticleSystem = infoIndexingCom.m_OriginalTrans.GetComponent <NcParticleSystem>();
                    FXMakerHierarchy.inst.SetActiveComponent(infoIndexingCom.m_OriginalTrans.gameObject, ncParticleSystem, true);
                    if (ncParticleSystem == null)
                    {
                        FxmPopupManager.inst.ShowWarningMessage("- Replay Error!!! : Used the ParticleEmitter.OneShot." + comName + ".\nYou must change this to NcParticleSystem.bBurst. First, add NcParticleSystem.", 5);
                    }
                    else
                    {
                        FxmPopupManager.inst.ShowWarningMessage("- Replay Error!!! : Used the ParticleEmitter.OneShot." + comName + ".\nYou must change this to NcParticleSystem.bBurst. Please click button(Inspector - 'Convert: OneShot To FXMakerBurst')", 5);
                    }
                }
            }
        }
        else
        if (findCom != null)
        {
            FxmPopupManager.inst.ShowToolMessage(" - Replay Error!!! : " + comName + " is included.\nThis component does not support the replay.", 5);
            return(false);
        }
        return(true);
    }
示例#10
0
    // Property -------------------------------------------------------------------------
    // Loop Function --------------------------------------------------------------------
    // Control Function -----------------------------------------------------------------
    // Particle
    public GameObject GetSharedParticleGameObject(GameObject originalParticlePrefab)
    {
        int nIndex = m_SharedPrefabs.IndexOf(originalParticlePrefab);

        if (nIndex < 0 || m_SharedGameObjects[nIndex] == null)
        {
            if (NcEffectBehaviour.IsSafe() == false)
            {
                return(null);
            }
            GameObject sharedObj = (GameObject)Object.Instantiate(originalParticlePrefab);
            sharedObj.transform.parent = NcEffectBehaviour.GetRootInstanceEffect().transform;
            if (0 <= nIndex)
            {
                m_SharedGameObjects[nIndex] = sharedObj;
            }
            else
            {
                m_SharedPrefabs.Add(originalParticlePrefab);
                m_SharedGameObjects.Add(sharedObj);
            }
            // Init sharedObj
            NcParticleSystem ps = sharedObj.GetComponent <NcParticleSystem>();
            if (ps)
            {
                ps.enabled = false;
            }
            NcParticleSystem ncPsCom = sharedObj.GetComponent <NcParticleSystem>();
            if (ncPsCom)
            {
                ncPsCom.m_bBurst = false;
            }
            ParticleSystem psCom = sharedObj.GetComponent <ParticleSystem>();
            if (psCom)
            {
                psCom.enableEmission = false;
            }

            return(sharedObj);
        }
        else
        {
            return(m_SharedGameObjects[nIndex]);
        }
    }
示例#11
0
 protected void DisableEmit()
 {
     NcParticleSystem[] componentsInChildren = base.gameObject.GetComponentsInChildren <NcParticleSystem>(true);
     NcParticleSystem[] array = componentsInChildren;
     for (int i = 0; i < array.Length; i++)
     {
         NcParticleSystem ncParticleSystem = array[i];
         if (ncParticleSystem != null)
         {
             ncParticleSystem.SetDisableEmit();
         }
     }
     NcAttachPrefab[] componentsInChildren2 = base.gameObject.GetComponentsInChildren <NcAttachPrefab>(true);
     NcAttachPrefab[] array2 = componentsInChildren2;
     for (int j = 0; j < array2.Length; j++)
     {
         NcAttachPrefab ncAttachPrefab = array2[j];
         if (ncAttachPrefab != null)
         {
             ncAttachPrefab.enabled = false;
         }
     }
     ParticleSystem[] componentsInChildren3 = base.gameObject.GetComponentsInChildren <ParticleSystem>(true);
     ParticleSystem[] array3 = componentsInChildren3;
     for (int k = 0; k < array3.Length; k++)
     {
         ParticleSystem particleSystem = array3[k];
         if (particleSystem != null)
         {
             particleSystem.enableEmission = false;
         }
     }
     ParticleEmitter[] componentsInChildren4 = base.gameObject.GetComponentsInChildren <ParticleEmitter>(true);
     ParticleEmitter[] array4 = componentsInChildren4;
     for (int l = 0; l < array4.Length; l++)
     {
         ParticleEmitter particleEmitter = array4[l];
         if (particleEmitter != null)
         {
             particleEmitter.emit = false;
         }
     }
 }
示例#12
0
 private void ShurikenInitParticle()
 {
     if (this.m_ps != null)
     {
         ParticleSystem expr_17 = this.m_ps;
         expr_17.set_startSize(expr_17.get_startSize() * this.m_fStartSizeRate);
         ParticleSystem expr_2F = this.m_ps;
         expr_2F.set_startLifetime(expr_2F.get_startLifetime() * this.m_fStartLifeTimeRate);
         ParticleSystem expr_47 = this.m_ps;
         expr_47.set_emissionRate(expr_47.get_emissionRate() * this.m_fStartEmissionRate);
         ParticleSystem expr_5F = this.m_ps;
         expr_5F.set_startSpeed(expr_5F.get_startSpeed() * this.m_fStartSpeedRate);
         ParticleSystemRenderer component = base.GetComponent <ParticleSystemRenderer>();
         if (component != null)
         {
             float num = (float)NcParticleSystem.Ng_GetProperty(component, "lengthScale");
             NcParticleSystem.Ng_SetProperty(component, "lengthScale", num * this.m_fRenderLengthRate);
         }
     }
 }
示例#13
0
 void Awake()
 {
     if (particlePrefab != null)
     {
         Transform parentNode = transform;
         if (particlePrefabParentRoot != null)
         {
             parentNode = particlePrefabParentRoot;
         }
         GameObject go = Instantiate(particlePrefab.gameObject, parentNode.position, Quaternion.identity) as GameObject;
         go.transform.SetParent(parentNode);
     }
     else
     {
         particlePrefab = GetComponent <NcParticleSystem>();
         if (null == particlePrefab)
         {
             Debug.LogError(gameObject.name + ": ParticleController" + " Error : NcParticleSystem is Empty");
         }
     }
 }
示例#14
0
    protected static Texture[] PreloadResource(GameObject tarObj, List <GameObject> parentPrefabList)
    {
        if (!NcEffectBehaviour.IsSafe())
        {
            return(null);
        }
        Renderer[]     componentsInChildren = tarObj.GetComponentsInChildren <Renderer>(true);
        List <Texture> list = new List <Texture>();

        Renderer[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            Renderer renderer = array[i];
            if (renderer.sharedMaterials != null && renderer.sharedMaterials.Length > 0)
            {
                Material[] sharedMaterials = renderer.sharedMaterials;
                for (int j = 0; j < sharedMaterials.Length; j++)
                {
                    Material material = sharedMaterials[j];
                    if (material != null && material.mainTexture != null)
                    {
                        list.Add(material.mainTexture);
                    }
                }
            }
        }
        NcAttachPrefab[] componentsInChildren2 = tarObj.GetComponentsInChildren <NcAttachPrefab>(true);
        NcAttachPrefab[] array2 = componentsInChildren2;
        for (int k = 0; k < array2.Length; k++)
        {
            NcAttachPrefab ncAttachPrefab = array2[k];
            if (ncAttachPrefab.m_AttachPrefab != null)
            {
                Texture[] array3 = NsEffectManager.PreloadPrefab(ncAttachPrefab.m_AttachPrefab, parentPrefabList, true);
                if (array3 == null)
                {
                    ncAttachPrefab.m_AttachPrefab = null;
                }
                else
                {
                    list.AddRange(array3);
                }
            }
        }
        NcParticleSystem[] componentsInChildren3 = tarObj.GetComponentsInChildren <NcParticleSystem>(true);
        NcParticleSystem[] array4 = componentsInChildren3;
        for (int l = 0; l < array4.Length; l++)
        {
            NcParticleSystem ncParticleSystem = array4[l];
            if (ncParticleSystem.m_AttachPrefab != null)
            {
                Texture[] array5 = NsEffectManager.PreloadPrefab(ncParticleSystem.m_AttachPrefab, parentPrefabList, true);
                if (array5 == null)
                {
                    ncParticleSystem.m_AttachPrefab = null;
                }
                else
                {
                    list.AddRange(array5);
                }
            }
        }
        NcSpriteTexture[] componentsInChildren4 = tarObj.GetComponentsInChildren <NcSpriteTexture>(true);
        NcSpriteTexture[] array6 = componentsInChildren4;
        for (int m = 0; m < array6.Length; m++)
        {
            NcSpriteTexture ncSpriteTexture = array6[m];
            if (ncSpriteTexture.m_NcSpriteFactoryPrefab != null)
            {
                Texture[] array7 = NsEffectManager.PreloadPrefab(ncSpriteTexture.m_NcSpriteFactoryPrefab, parentPrefabList, false);
                if (array7 != null)
                {
                    list.AddRange(array7);
                }
            }
        }
        NcParticleSpiral[] componentsInChildren5 = tarObj.GetComponentsInChildren <NcParticleSpiral>(true);
        NcParticleSpiral[] array8 = componentsInChildren5;
        for (int n = 0; n < array8.Length; n++)
        {
            NcParticleSpiral ncParticleSpiral = array8[n];
            if (ncParticleSpiral.m_ParticlePrefab != null)
            {
                Texture[] array9 = NsEffectManager.PreloadPrefab(ncParticleSpiral.m_ParticlePrefab, parentPrefabList, false);
                if (array9 != null)
                {
                    list.AddRange(array9);
                }
            }
        }
        NcParticleEmit[] componentsInChildren6 = tarObj.GetComponentsInChildren <NcParticleEmit>(true);
        NcParticleEmit[] array10 = componentsInChildren6;
        for (int num = 0; num < array10.Length; num++)
        {
            NcParticleEmit ncParticleEmit = array10[num];
            if (ncParticleEmit.m_ParticlePrefab != null)
            {
                Texture[] array11 = NsEffectManager.PreloadPrefab(ncParticleEmit.m_ParticlePrefab, parentPrefabList, false);
                if (array11 != null)
                {
                    list.AddRange(array11);
                }
            }
        }
        NcAttachSound[] componentsInChildren7 = tarObj.GetComponentsInChildren <NcAttachSound>(true);
        NcAttachSound[] array12 = componentsInChildren7;
        for (int num2 = 0; num2 < array12.Length; num2++)
        {
            NcAttachSound ncAttachSound = array12[num2];
            if (ncAttachSound.m_AudioClip != null)
            {
            }
        }
        NcSpriteFactory[] componentsInChildren8 = tarObj.GetComponentsInChildren <NcSpriteFactory>(true);
        NcSpriteFactory[] array13 = componentsInChildren8;
        for (int num3 = 0; num3 < array13.Length; num3++)
        {
            NcSpriteFactory ncSpriteFactory = array13[num3];
            if (ncSpriteFactory.m_SpriteList != null)
            {
                for (int num4 = 0; num4 < ncSpriteFactory.m_SpriteList.Count; num4++)
                {
                    if (ncSpriteFactory.m_SpriteList[num4].m_EffectPrefab != null)
                    {
                        Texture[] array14 = NsEffectManager.PreloadPrefab(ncSpriteFactory.m_SpriteList[num4].m_EffectPrefab, parentPrefabList, true);
                        if (array14 == null)
                        {
                            ncSpriteFactory.m_SpriteList[num4].m_EffectPrefab = null;
                        }
                        else
                        {
                            list.AddRange(array14);
                        }
                        if (ncSpriteFactory.m_SpriteList[num4].m_AudioClip != null)
                        {
                        }
                    }
                }
            }
        }
        return(list.ToArray());
    }
示例#15
0
    private static Texture[] PreloadTexture(GameObject tarObj, List <GameObject> parentPrefabList)
    {
        if (!NcEffectBehaviour.IsSafe())
        {
            return(null);
        }
        Renderer[]     componentsInChildren = tarObj.GetComponentsInChildren <Renderer>(true);
        List <Texture> list = new List <Texture>();

        Renderer[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            Renderer renderer = array[i];
            if (renderer.get_sharedMaterials() != null && renderer.get_sharedMaterials().Length > 0)
            {
                Material[] sharedMaterials = renderer.get_sharedMaterials();
                for (int j = 0; j < sharedMaterials.Length; j++)
                {
                    Material material = sharedMaterials[j];
                    if (material != null && material.get_mainTexture() != null)
                    {
                        list.Add(material.get_mainTexture());
                    }
                }
            }
        }
        NcAttachPrefab[] componentsInChildren2 = tarObj.GetComponentsInChildren <NcAttachPrefab>(true);
        NcAttachPrefab[] array2 = componentsInChildren2;
        for (int k = 0; k < array2.Length; k++)
        {
            NcAttachPrefab ncAttachPrefab = array2[k];
            if (ncAttachPrefab.m_AttachPrefab != null)
            {
                Texture[] array3 = NcEffectBehaviour.PreloadPrefab(ncAttachPrefab.m_AttachPrefab, parentPrefabList, true);
                if (array3 == null)
                {
                    ncAttachPrefab.m_AttachPrefab = null;
                }
                else
                {
                    list.AddRange(array3);
                }
            }
        }
        NcParticleSystem[] componentsInChildren3 = tarObj.GetComponentsInChildren <NcParticleSystem>(true);
        NcParticleSystem[] array4 = componentsInChildren3;
        for (int l = 0; l < array4.Length; l++)
        {
            NcParticleSystem ncParticleSystem = array4[l];
            if (ncParticleSystem.m_AttachPrefab != null)
            {
                Texture[] array5 = NcEffectBehaviour.PreloadPrefab(ncParticleSystem.m_AttachPrefab, parentPrefabList, true);
                if (array5 == null)
                {
                    ncParticleSystem.m_AttachPrefab = null;
                }
                else
                {
                    list.AddRange(array5);
                }
            }
        }
        NcSpriteTexture[] componentsInChildren4 = tarObj.GetComponentsInChildren <NcSpriteTexture>(true);
        NcSpriteTexture[] array6 = componentsInChildren4;
        for (int m = 0; m < array6.Length; m++)
        {
            NcSpriteTexture ncSpriteTexture = array6[m];
            if (ncSpriteTexture.m_NcSpriteFactoryPrefab != null)
            {
                Texture[] array7 = NcEffectBehaviour.PreloadPrefab(ncSpriteTexture.m_NcSpriteFactoryPrefab, parentPrefabList, false);
                if (array7 != null)
                {
                    list.AddRange(array7);
                }
            }
        }
        NcAttachSound[] componentsInChildren5 = tarObj.GetComponentsInChildren <NcAttachSound>(true);
        NcAttachSound[] array8 = componentsInChildren5;
        for (int n = 0; n < array8.Length; n++)
        {
            NcAttachSound ncAttachSound = array8[n];
            if (ncAttachSound.m_AudioClip != null)
            {
            }
        }
        NcSpriteFactory[] componentsInChildren6 = tarObj.GetComponentsInChildren <NcSpriteFactory>(true);
        NcSpriteFactory[] array9 = componentsInChildren6;
        for (int num = 0; num < array9.Length; num++)
        {
            NcSpriteFactory ncSpriteFactory = array9[num];
            if (ncSpriteFactory.m_SpriteList != null)
            {
                for (int num2 = 0; num2 < ncSpriteFactory.m_SpriteList.get_Count(); num2++)
                {
                    if (ncSpriteFactory.m_SpriteList.get_Item(num2).m_EffectPrefab != null)
                    {
                        Texture[] array10 = NcEffectBehaviour.PreloadPrefab(ncSpriteFactory.m_SpriteList.get_Item(num2).m_EffectPrefab, parentPrefabList, true);
                        if (array10 == null)
                        {
                            ncSpriteFactory.m_SpriteList.get_Item(num2).m_EffectPrefab = null;
                        }
                        else
                        {
                            list.AddRange(array10);
                        }
                        if (ncSpriteFactory.m_SpriteList.get_Item(num2).m_AudioClip != null)
                        {
                        }
                    }
                }
            }
        }
        return(list.ToArray());
    }
示例#16
0
 protected static Component GetComponentInChildren(GameObject tarObj, Type findType, List <GameObject> parentPrefabList)
 {
     Component[] componentsInChildren = tarObj.GetComponentsInChildren(findType, true);
     Component[] array = componentsInChildren;
     for (int i = 0; i < array.Length; i++)
     {
         Component component = array[i];
         if (component.GetComponent <NcDontActive>() == null)
         {
             return(component);
         }
     }
     NcAttachPrefab[] componentsInChildren2 = tarObj.GetComponentsInChildren <NcAttachPrefab>(true);
     NcAttachPrefab[] array2 = componentsInChildren2;
     for (int j = 0; j < array2.Length; j++)
     {
         NcAttachPrefab ncAttachPrefab = array2[j];
         if (ncAttachPrefab.m_AttachPrefab != null)
         {
             Component validComponentInChildren = NsEffectManager.GetValidComponentInChildren(ncAttachPrefab.m_AttachPrefab, findType, parentPrefabList, true);
             if (validComponentInChildren != null)
             {
                 return(validComponentInChildren);
             }
         }
     }
     NcParticleSystem[] componentsInChildren3 = tarObj.GetComponentsInChildren <NcParticleSystem>(true);
     NcParticleSystem[] array3 = componentsInChildren3;
     for (int k = 0; k < array3.Length; k++)
     {
         NcParticleSystem ncParticleSystem = array3[k];
         if (ncParticleSystem.m_AttachPrefab != null)
         {
             Component validComponentInChildren = NsEffectManager.GetValidComponentInChildren(ncParticleSystem.m_AttachPrefab, findType, parentPrefabList, true);
             if (validComponentInChildren != null)
             {
                 return(validComponentInChildren);
             }
         }
     }
     NcSpriteTexture[] componentsInChildren4 = tarObj.GetComponentsInChildren <NcSpriteTexture>(true);
     NcSpriteTexture[] array4 = componentsInChildren4;
     for (int l = 0; l < array4.Length; l++)
     {
         NcSpriteTexture ncSpriteTexture = array4[l];
         if (ncSpriteTexture.m_NcSpriteFactoryPrefab != null)
         {
             Component validComponentInChildren = NsEffectManager.GetValidComponentInChildren(ncSpriteTexture.m_NcSpriteFactoryPrefab, findType, parentPrefabList, false);
             if (validComponentInChildren != null)
             {
                 return(validComponentInChildren);
             }
         }
     }
     NcParticleSpiral[] componentsInChildren5 = tarObj.GetComponentsInChildren <NcParticleSpiral>(true);
     NcParticleSpiral[] array5 = componentsInChildren5;
     for (int m = 0; m < array5.Length; m++)
     {
         NcParticleSpiral ncParticleSpiral = array5[m];
         if (ncParticleSpiral.m_ParticlePrefab != null)
         {
             Component validComponentInChildren = NsEffectManager.GetValidComponentInChildren(ncParticleSpiral.m_ParticlePrefab, findType, parentPrefabList, false);
             if (validComponentInChildren != null)
             {
                 return(validComponentInChildren);
             }
         }
     }
     NcParticleEmit[] componentsInChildren6 = tarObj.GetComponentsInChildren <NcParticleEmit>(true);
     NcParticleEmit[] array6 = componentsInChildren6;
     for (int n = 0; n < array6.Length; n++)
     {
         NcParticleEmit ncParticleEmit = array6[n];
         if (ncParticleEmit.m_ParticlePrefab != null)
         {
             Component validComponentInChildren = NsEffectManager.GetValidComponentInChildren(ncParticleEmit.m_ParticlePrefab, findType, parentPrefabList, false);
             if (validComponentInChildren != null)
             {
                 return(validComponentInChildren);
             }
         }
     }
     NcSpriteFactory[] componentsInChildren7 = tarObj.GetComponentsInChildren <NcSpriteFactory>(true);
     NcSpriteFactory[] array7 = componentsInChildren7;
     for (int num = 0; num < array7.Length; num++)
     {
         NcSpriteFactory ncSpriteFactory = array7[num];
         if (ncSpriteFactory.m_SpriteList != null)
         {
             for (int num2 = 0; num2 < ncSpriteFactory.m_SpriteList.Count; num2++)
             {
                 if (ncSpriteFactory.m_SpriteList[num2].m_EffectPrefab != null)
                 {
                     Component validComponentInChildren = NsEffectManager.GetValidComponentInChildren(ncSpriteFactory.m_SpriteList[num2].m_EffectPrefab, findType, parentPrefabList, true);
                     if (validComponentInChildren != null)
                     {
                         return(validComponentInChildren);
                     }
                 }
             }
         }
     }
     return(null);
 }
示例#17
0
 // Property -------------------------------------------------------------------------
 // Event Function -------------------------------------------------------------------
 void OnEnable()
 {
     m_Sel = target as NcParticleSystem;
     m_UndoManager	= new FXMakerUndoManager(m_Sel, "NcParticleSystem");
 }
 // Property -------------------------------------------------------------------------
 // Event Function -------------------------------------------------------------------
 void OnEnable()
 {
     m_Sel         = target as NcParticleSystem;
     m_UndoManager = new FXMakerUndoManager(m_Sel, "NcParticleSystem");
 }
示例#19
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);
    }