示例#1
0
 private void CollectComponents()
 {
     GetComponentsInChildren(Renderers);
     GetComponentsInChildren(Graphics);
     OriginalGraphicMaterials.Clear();
     DestroyInstantiatedMaterials();
     InstantiatedGraphicMaterials.Clear();
 }
示例#2
0
 public void BeginEffect()
 {
     if (!enabled)
     {
         return;
     }
     for (var i = 0; i < Graphics.Count; i++)
     {
         Graphic  graphic = Graphics[i];
         Material instantiatedGraphicMaterial;
         if (i >= OriginalGraphicMaterials.Count || Graphics[i].material != OriginalGraphicMaterials[i])
         {
             instantiatedGraphicMaterial = Instantiate(graphic.material);
             if (i >= OriginalGraphicMaterials.Count)
             {
                 OriginalGraphicMaterials.Add(graphic.material);
                 InstantiatedGraphicMaterials.Add(instantiatedGraphicMaterial);
             }
             else
             {
                 OriginalGraphicMaterials[i]     = graphic.material;
                 InstantiatedGraphicMaterials[i] = instantiatedGraphicMaterial;
             }
         }
         else
         {
             instantiatedGraphicMaterial = InstantiatedGraphicMaterials[i];
         }
         instantiatedGraphicMaterial.SetInt("_GlobalOutline", 1);
         graphic.material = instantiatedGraphicMaterial;
     }
     foreach (var renderer in Renderers)
     {
         renderer.material.SetInt("_GlobalOutline", 1);
     }
 }