Пример #1
0
 public static void SetIsNearCamera(Transform root, bool isHide = false)
 {
     if (!SystemConfig.IsFindOcclusionByCameraOn)
     {
         return;
     }
     if (!SystemConfig.IsShaderEffectOn)
     {
         return;
     }
     if (root == null)
     {
         return;
     }
     Renderer[] componentsInChildren = root.GetComponentsInChildren <Renderer>(true);
     for (int i = 0; i < componentsInChildren.Length; i++)
     {
         Renderer renderer = componentsInChildren[i];
         if (!LayerSystem.IsSpecialEffectLayers(renderer.get_gameObject().get_layer()) && !ShadowSlicePlaneMgr.IsShadow(renderer.get_gameObject()))
         {
             Material[] materials = renderer.get_materials();
             if (materials != null && materials.Length > 0)
             {
                 AdjustTransparency adjustTransparency = renderer.get_gameObject().AddMissingComponent <AdjustTransparency>();
                 adjustTransparency.SetIsNearCamera(isHide);
             }
         }
     }
 }
Пример #2
0
 public static void InitTransparencys(List <Renderer> renderers, List <AdjustTransparency> alphaControls)
 {
     if (!SystemConfig.IsShaderEffectOn)
     {
         return;
     }
     if (renderers == null || renderers.get_Count() == 0)
     {
         return;
     }
     alphaControls.Clear();
     for (int i = 0; i < renderers.get_Count(); i++)
     {
         Renderer renderer = renderers.get_Item(i);
         if (renderer == null)
         {
             Debug.LogError("item is null");
         }
         else if (renderer.get_gameObject().get_activeSelf())
         {
             if (!LayerSystem.IsSpecialEffectLayers(renderer.get_gameObject().get_layer()))
             {
                 if (renderer.get_materials() != null && renderer.get_materials().Length > 0)
                 {
                     AdjustTransparency adjustTransparency = renderer.get_gameObject().AddMissingComponent <AdjustTransparency>();
                     adjustTransparency.Init(renderer);
                     alphaControls.Add(adjustTransparency);
                 }
             }
         }
     }
 }
Пример #3
0
 private void OnFun_ActorAnim(GameObject sender)
 {
     InstanceManager.IsActorAnimatorOn = !InstanceManager.IsActorAnimatorOn;
     this.Find();
     for (int i = 0; i < this.listModelOfNoBattle.get_Count(); i++)
     {
         Animator[] componentsInChildren = this.listModelOfNoBattle.get_Item(i).GetComponentsInChildren <Animator>(true);
         for (int j = 0; j < componentsInChildren.Length; j++)
         {
             if (!LayerSystem.IsSpecialEffectLayers(componentsInChildren[j].get_gameObject().get_layer()))
             {
                 componentsInChildren[j].set_enabled(InstanceManager.IsActorAnimatorOn);
             }
         }
     }
 }
Пример #4
0
 private void OnFun_ActorModel(GameObject sender)
 {
     this.Find();
     this.IsShowModel = !this.IsShowModel;
     for (int i = 0; i < this.listModelOfAll.get_Count(); i++)
     {
         Renderer[] componentsInChildren = this.listModelOfAll.get_Item(i).GetComponentsInChildren <Renderer>(true);
         for (int j = 0; j < componentsInChildren.Length; j++)
         {
             if (!LayerSystem.IsSpecialEffectLayers(componentsInChildren[j].get_gameObject().get_layer()))
             {
                 componentsInChildren[j].get_gameObject().SetActive(this.IsShowModel);
                 componentsInChildren[j].set_enabled(this.IsShowModel);
             }
         }
         this.listModelOfAll.get_Item(i).SetActive(this.IsShowModel);
     }
 }
Пример #5
0
 public static void InitHitEffects(List <Renderer> shaderRenderers, List <ActorHitEffectBase> hitControls)
 {
     if (!SystemConfig.IsShaderEffectOn)
     {
         return;
     }
     if (shaderRenderers == null || shaderRenderers.get_Count() == 0)
     {
         return;
     }
     hitControls.Clear();
     for (int i = 0; i < shaderRenderers.get_Count(); i++)
     {
         if (!(shaderRenderers.get_Item(i) == null))
         {
             if (!LayerSystem.IsSpecialEffectLayers(shaderRenderers.get_Item(i).get_gameObject().get_layer()))
             {
                 for (int j = 0; j < shaderRenderers.get_Item(i).get_sharedMaterials().Length; j++)
                 {
                     Material material = shaderRenderers.get_Item(i).get_sharedMaterials()[j];
                     if (material != null && material.get_shader() != null)
                     {
                         ActorHitEffectBase actorHitEffectBase = null;
                         Shader             shader             = material.get_shader();
                         bool flag = false;
                         if (!flag)
                         {
                             int k = 0;
                             while (k < ShaderEffectUtils.HitShaders.Length)
                             {
                                 if (shader.get_name().Equals(ShaderEffectUtils.HitShaders[k]))
                                 {
                                     if (actorHitEffectBase != null && actorHitEffectBase is ActorHitEffect)
                                     {
                                         actorHitEffectBase.set_enabled(true);
                                         flag = true;
                                         break;
                                     }
                                     if (actorHitEffectBase != null)
                                     {
                                         actorHitEffectBase.set_enabled(false);
                                     }
                                     actorHitEffectBase = shaderRenderers.get_Item(i).get_gameObject().AddMissingComponent <ActorHitEffect>();
                                     flag = true;
                                     break;
                                 }
                                 else
                                 {
                                     k++;
                                 }
                             }
                         }
                         if (flag && actorHitEffectBase != null)
                         {
                             actorHitEffectBase.Init(shaderRenderers.get_Item(i));
                             hitControls.Add(actorHitEffectBase);
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
Пример #6
0
 public static bool IsIgnoreLayers(int layer, int ignoreType)
 {
     return(ignoreType != 1 && ignoreType == 2 && LayerSystem.IsSpecialEffectLayers(layer));
 }