public void BroadcastShaderSetup(CTSProfile profile)
 {
     if (Object.op_Inequality((Object)Terrain.get_activeTerrain(), (Object)null))
     {
         CompleteTerrainShader component = (CompleteTerrainShader)((Component)Terrain.get_activeTerrain()).GetComponent <CompleteTerrainShader>();
         if (Object.op_Inequality((Object)component, (Object)null) && Object.op_Inequality((Object)component.Profile, (Object)null) && ((Object)component.Profile).get_name() == ((Object)profile).get_name())
         {
             component.UpdateProfileFromTerrainForced();
             this.BroadcastProfileUpdate(profile);
             return;
         }
     }
     foreach (CompleteTerrainShader shader in this.m_shaderSet)
     {
         if (Object.op_Inequality((Object)shader.Profile, (Object)null))
         {
             if (Object.op_Equality((Object)profile, (Object)null))
             {
                 shader.UpdateProfileFromTerrainForced();
             }
             else if (((Object)shader.Profile).get_name() == ((Object)profile).get_name())
             {
                 shader.UpdateProfileFromTerrainForced();
                 this.BroadcastProfileUpdate(profile);
                 break;
             }
         }
     }
 }
        /// <summary>
        /// Broadcast a shader setup on the selected profile in the scene, otherwise all
        /// </summary>
        /// <param name="profile">Profile being updated, otherwise all</param>
        public void BroadcastShaderSetup(CTSProfile profile)
        {
            //Make sure shaders are registered
            RegisterAllShaders(true);

            //First - check to see if we have one on the currently selected terrain - this will usually be where texture changes have been made
            CompleteTerrainShader shader = null;

            if (Terrain.activeTerrain != null)
            {
                shader = Terrain.activeTerrain.GetComponent <CompleteTerrainShader>();
                if (shader != null && shader.Profile != null)
                {
                    if (shader.Profile.GetInstanceID() == profile.GetInstanceID())
                    {
                        shader.UpdateProfileFromTerrainForced();
                        BroadcastProfileUpdate(profile);
                        return;
                    }
                }
            }

            //Otherwise broadcast the setup
            for (int idx = 0; idx < m_shaderList.Count; idx++)
            {
                shader = m_shaderList[idx];
                if (shader != null && shader.Profile != null)
                {
                    if (profile == null)
                    {
                        shader.UpdateProfileFromTerrainForced();
                    }
                    else
                    {
                        //Find the first match and update it
                        if (shader.Profile.GetInstanceID() == profile.GetInstanceID())
                        {
                            shader.UpdateProfileFromTerrainForced();
                            BroadcastProfileUpdate(profile);
                            return;
                        }
                    }
                }
            }
        }