예제 #1
0
    void ChangeMeshColor(MeshFilter mFilter, Color tarColor)
    {
        if (mFilter == null || mFilter.mesh == null)
        {
            Debug.LogWarning("ChangeMeshColor mFilter : " + mFilter);
            Debug.LogWarning("ChangeMeshColor mFilter.mesh : " + mFilter.mesh);
            return;
        }

        Color[] colors = mFilter.mesh.colors;
        if (colors.Length == 0)
        {
            if (mFilter.mesh.vertices.Length == 0)
            {
                NcSpriteFactory.CreateEmptyMesh(mFilter);
            }
            colors = new Color[mFilter.mesh.vertices.Length];
            for (int c = 0; c < colors.Length; c++)
            {
                colors[c] = Color.white;
            }
        }

        for (int c = 0; c < colors.Length; c++)
        {
            colors[c] = tarColor;
        }
        mFilter.mesh.colors = colors;
    }
예제 #2
0
 private void ChangeMeshColor(MeshFilter mFilter, Color tarColor)
 {
     if (mFilter == null || mFilter.mesh == null)
     {
         Debug.LogWarning("ChangeMeshColor mFilter : " + mFilter);
         Debug.LogWarning("ChangeMeshColor mFilter.mesh : " + mFilter.mesh);
         return;
     }
     Color[] array = mFilter.mesh.colors;
     if (array.Length == 0)
     {
         if (mFilter.mesh.vertices.Length == 0)
         {
             NcSpriteFactory.CreateEmptyMesh(mFilter);
         }
         array = new Color[mFilter.mesh.vertices.Length];
         for (int i = 0; i < array.Length; i++)
         {
             array[i] = Color.white;
         }
     }
     for (int j = 0; j < array.Length; j++)
     {
         array[j] = tarColor;
     }
     mFilter.mesh.colors = array;
 }
예제 #3
0
 private void ChangeAlpha(float alpha)
 {
     if (this.Type == ChangeAlphaType.Material)
     {
         for (int i = 0; i < this.rens.Length; i++)
         {
             Renderer renderer          = this.rens[i];
             string   materialColorName = AutoAlpha.GetMaterialColorName(renderer.sharedMaterial);
             if (materialColorName != null)
             {
                 Color color = renderer.material.GetColor(materialColorName);
                 color.a = alpha;
                 renderer.material.SetColor(materialColorName, color);
             }
         }
     }
     else
     {
         for (int j = 0; j < this.meshFilters.Length; j++)
         {
             Color[] array = this.meshFilters[j].mesh.colors;
             if (array.Length == 0)
             {
                 if (this.meshFilters[j].mesh.vertices.Length == 0)
                 {
                     NcSpriteFactory.CreateEmptyMesh(this.meshFilters[j]);
                 }
                 array = new Color[this.meshFilters[j].mesh.vertices.Length];
                 for (int k = 0; k < array.Length; k++)
                 {
                     array[k] = Color.white;
                 }
             }
             for (int l = 0; l < array.Length; l++)
             {
                 Color color2 = array[l];
                 color2.a = alpha;
                 array[l] = color2;
             }
             this.meshFilters[j].mesh.colors = array;
         }
     }
 }
예제 #4
0
    void ChangeToAlpha(float fElapsedRate)
    {
        float fAlphaValue = Mathf.Lerp(m_fFromAlphaValue, m_fToMeshValue, fElapsedRate);

        if (m_TargetType == TARGET_TYPE.MeshColor)
        {
            MeshFilter[] meshFilters;
            if (m_bRecursively)
            {
                meshFilters = transform.GetComponentsInChildren <MeshFilter>(true);
            }
            else
            {
                meshFilters = transform.GetComponents <MeshFilter>();
            }
            Color color;
            for (int n = 0; n < meshFilters.Length; n++)
            {
                Color[] colors = meshFilters[n].mesh.colors;
                if (colors.Length == 0)
                {
                    if (meshFilters[n].mesh.vertices.Length == 0)
                    {
                        NcSpriteFactory.CreateEmptyMesh(meshFilters[n]);
                    }
                    colors = new Color[meshFilters[n].mesh.vertices.Length];
                    for (int c = 0; c < colors.Length; c++)
                    {
                        colors[c] = Color.white;
                    }
                }

                for (int c = 0; c < colors.Length; c++)
                {
                    color     = colors[c];
                    color.a   = fAlphaValue;
                    colors[c] = color;
                }

                meshFilters[n].mesh.colors = colors;
            }
        }
        else
        {
            Renderer[] rens;
            if (m_bRecursively)
            {
                rens = transform.GetComponentsInChildren <Renderer>(true);
            }
            else
            {
                rens = transform.GetComponents <Renderer>();
            }
            for (int n = 0; n < rens.Length; n++)
            {
                Renderer ren     = rens[n];
                string   colName = GetMaterialColorName(ren.sharedMaterial);

                if (colName != null)
                {
                    Color col = ren.material.GetColor(colName);
                    col.a = fAlphaValue;
                    ren.material.SetColor(colName, col);
                }
            }
        }

        if (fElapsedRate == 1 && fAlphaValue == 0)
        {
            SetActiveRecursively(gameObject, false);
        }
    }
예제 #5
0
    private void ChangeToAlpha(float fElapsedRate)
    {
        float num = Mathf.Lerp(this.m_fFromAlphaValue, this.m_fToMeshValue, fElapsedRate);

        if (this.m_TargetType == NcChangeAlpha.TARGET_TYPE.MeshColor)
        {
            MeshFilter[] array;
            if (this.m_bRecursively)
            {
                array = base.transform.GetComponentsInChildren <MeshFilter>(true);
            }
            else
            {
                array = base.transform.GetComponents <MeshFilter>();
            }
            for (int i = 0; i < array.Length; i++)
            {
                Color[] array2 = array[i].mesh.colors;
                if (array2.Length == 0)
                {
                    if (array[i].mesh.vertices.Length == 0)
                    {
                        NcSpriteFactory.CreateEmptyMesh(array[i]);
                    }
                    array2 = new Color[array[i].mesh.vertices.Length];
                    for (int j = 0; j < array2.Length; j++)
                    {
                        array2[j] = Color.white;
                    }
                }
                for (int k = 0; k < array2.Length; k++)
                {
                    Color color = array2[k];
                    color.a   = num;
                    array2[k] = color;
                }
                array[i].mesh.colors = array2;
            }
        }
        else
        {
            Renderer[] array3;
            if (this.m_bRecursively)
            {
                array3 = base.transform.GetComponentsInChildren <Renderer>(true);
            }
            else
            {
                array3 = base.transform.GetComponents <Renderer>();
            }
            for (int l = 0; l < array3.Length; l++)
            {
                Renderer renderer          = array3[l];
                string   materialColorName = NcEffectBehaviour.GetMaterialColorName(renderer.sharedMaterial);
                if (materialColorName != null)
                {
                    Color color2 = renderer.material.GetColor(materialColorName);
                    color2.a = num;
                    renderer.material.SetColor(materialColorName, color2);
                }
            }
        }
        if (fElapsedRate == 1f && num == 0f)
        {
            NcEffectBehaviour.SetActiveRecursively(base.gameObject, false);
        }
    }