Esempio n. 1
0
    void SetActiveMaterialColor(Color newColor)
    {
        Material newMat = m_SelectedMaterial;

        // Create mat
        if (m_SelectedMaterial == null)
        {
            newMat = CreateDefaultMaterial();
        }
        else
        {
            if (m_SelectedMaterial == m_OriMaterial)
            {
                newMat = new Material(m_SelectedMaterial);
            }
        }

        // Change Color
        NgMaterial.SetMaterialColor(newMat, newColor);
        if (m_NewShaderMaterials != null)
        {
            foreach (Material mat in m_NewShaderMaterials)
            {
                NgMaterial.SetMaterialColor(mat, newColor);
            }
        }

        // Current Change
        SetSelectedTransformMaterial(newMat);
    }
Esempio n. 2
0
 public static void CopyMaterialArgument(Material srcMat, Material tarMat)
 {
     tarMat.mainTexture       = srcMat.mainTexture;
     tarMat.mainTextureOffset = srcMat.mainTextureOffset;
     tarMat.mainTextureScale  = srcMat.mainTextureScale;
     if (NgMaterial.IsMaskTexture(srcMat) && NgMaterial.IsMaskTexture(tarMat))
     {
         NgMaterial.SetMaskTexture(tarMat, NgMaterial.GetMaskTexture(srcMat));
     }
     NgMaterial.SetMaterialColor(tarMat, NgMaterial.GetMaterialColor(srcMat, new Color(0.5f, 0.5f, 0.5f, 0.5f)));
 }