Exemple #1
0
 public void Init(LKCurveInfo lkCurveInfo)
 {
     if (lkCurveInfo.bRecursive)
     {
         if (this.mChildColorNames == null)
         {
             Renderer[] renderers = this.mGameObject.GetComponentsInChildren <Renderer>(true);
             this.mChildColorNames     = new string[renderers.Length];
             this.mChildMaterials      = new Material[renderers.Length];
             this.mChildOriginalColors = new Color[renderers.Length];
             int i    = 0;
             int nmax = renderers.Length;
             while (i < nmax)
             {
                 Renderer ren = renderers[i];
                 this.mChildMaterials[i]      = ren.material;
                 this.mChildColorNames[i]     = LKMaterialUtils.GetMaterialColorName(this.mChildMaterials[i]);
                 this.mChildOriginalColors[i] = this.mChildMaterials[i].GetColor(this.mChildColorNames[i]);
                 i++;
             }
         }
     }
     else
     {
         if (this.mMaterial == null)
         {
             Renderer renderer = this.mGameObject.GetComponent <Renderer>();
             if (renderer != null)
             {
                 this.mMaterial      = renderer.material;
                 this.mColorName     = LKMaterialUtils.GetMaterialColorName(this.mMaterial);
                 this.mOriginalColor = this.mMaterial.GetColor(this.mColorName);
             }
             else
             {
                 Debug.LogError("Material Color Animation, Renderer or Material is missing!");
             }
         }
     }
 }
Exemple #2
0
 public static Color GetMaterialColor(Material mat)
 {
     return(LKMaterialUtils.GetMaterialColor(mat, Color.white));
 }