protected virtual void ChangeMaterialColor(GameObject givenObject, Color givenColor)
        {
            if (givenObject)
            {
                Renderer[] foundRenderers = givenObject.GetComponentsInChildren <Renderer>();
                for (int i = 0; i < foundRenderers.Length; i++)
                {
                    Renderer foundRenderer = foundRenderers[i];
                    if (foundRenderer.material)
                    {
                        foundRenderer.material.EnableKeyword("_EMISSION");

                        if (foundRenderer.material.HasProperty("_Color"))
                        {
                            foundRenderer.material.color = givenColor;
                        }

                        if (foundRenderer.material.HasProperty("_EmissionColor"))
                        {
                            foundRenderer.material.SetColor("_EmissionColor", VRTK_SharedMethods.ColorDarken(givenColor, 50));
                        }
                    }
                }
            }
        }
Example #2
0
        private void setMaterial(GameObject item, Material material, Color color)
        {
            foreach (Renderer mr in item.GetComponentsInChildren <Renderer>())
            {
                if (material != null)
                {
                    mr.material = material;
                }

                if (mr.material)
                {
                    mr.material.EnableKeyword("_EMISSION");

                    if (mr.material.HasProperty("_Color"))
                    {
                        mr.material.color = color;
                    }

                    if (mr.material.HasProperty("_EmissionColor"))
                    {
                        mr.material.SetColor("_EmissionColor", VRTK_SharedMethods.ColorDarken(color, 50));
                    }
                }
            }
        }
Example #3
0
 // Token: 0x06001713 RID: 5907 RVA: 0x0007BE70 File Offset: 0x0007A070
 protected virtual void SetMaterial(Material material, Color color)
 {
     if (material != null)
     {
         material.EnableKeyword("_EMISSION");
         if (material.HasProperty("_Color"))
         {
             material.color = color;
         }
         if (material.HasProperty("_EmissionColor"))
         {
             material.SetColor("_EmissionColor", VRTK_SharedMethods.ColorDarken(color, 50f));
         }
     }
 }
Example #4
0
 // Token: 0x060018E1 RID: 6369 RVA: 0x00084ABC File Offset: 0x00082CBC
 protected virtual void ChangeMaterialColor(GameObject obj, Color color)
 {
     foreach (Renderer renderer in obj.GetComponentsInChildren <Renderer>())
     {
         if (renderer.material)
         {
             renderer.material.EnableKeyword("_EMISSION");
             if (renderer.material.HasProperty("_Color"))
             {
                 renderer.material.color = color;
             }
             if (renderer.material.HasProperty("_EmissionColor"))
             {
                 renderer.material.SetColor("_EmissionColor", VRTK_SharedMethods.ColorDarken(color, 50f));
             }
         }
     }
 }