Exemple #1
0
        // UPDATE MATERIALS //
        //
        public void UpdateMaterials()
        {
            MeshRenderer mr = GetComponent <MeshRenderer>();

            Material[] materials = new Material[blueprint.renderStack.modules.Count];

            for (int i = 0; i < blueprint.renderStack.modules.Count; i++)
            {
                BaseRenderModule rm = blueprint.renderStack.modules[i] as BaseRenderModule;
                materials[i] = rm.particleMaterial.GetValue();
            }

            mr.materials = materials;
        }
Exemple #2
0
        // EVALUATE //
        //
        override public void Evaluate()
        {
            if (stackFunction == AmpsHelpers.eStackFunction.Render)
            {
                int i = 0;
                CombineInstance[] subMeshes = new CombineInstance[modules.Count];

                foreach (BaseModule m in modules)
                {
                    CombineInstance ci = new CombineInstance();
                    if (m.isEnabled)
                    {
                        BaseRenderModule rm = m as BaseRenderModule;
                        rm.Evaluate();
                        if (rm.finalMesh != null)
                        {
                            ci.mesh = rm.finalMesh;
                        }
                        else
                        {
                            ci.mesh = new Mesh();
                        }
                    }
                    else
                    {
                        ci.mesh = new Mesh();
                    }

                    subMeshes[i] = ci;
                    i++;
                }

                if (ownerBlueprint.ownerEmitter.emitterMesh == null)
                {
                    Debug.Log("ownerBlueprint.ownerEmitter.emitterMesh == null");
                }
                ownerBlueprint.ownerEmitter.emitterMesh.CombineMeshes(subMeshes, false, false);
            }
            else
            {
                foreach (BaseModule m in modules)
                {
                    if (m.isEnabled)
                    {
                        m.Evaluate();
                    }
                }
            }
        }