void PlayMaterialControl() { List <Material> mats = new List <Material>(); mats.Clear(); if (useMultiColor) { foreach (LineRenderer line in m_subLineRenders) { mats.AddRange(line.materials); } UVScroll.SetMaterialInstance(mats); } else { mats.AddRange(m_LineRender.materials); } //把材质设置进动画里 if (FadeInOutMaterialColor) { //如果运行模式不是外部指定的 if (FadeInOutMaterialColor.RunMode == EffectRunMode.OutSiedePointed) { FadeInOutMaterialColor.SetMaterialInstance(mats); FadeInOutMaterialColor.Play(); } } if (FadeInOutMaterialFloat) { //如果运行模式不是外部指定的 if (FadeInOutMaterialFloat.RunMode == EffectRunMode.OutSiedePointed) { FadeInOutMaterialFloat.SetMaterialInstance(mats); FadeInOutMaterialFloat.Play(); } } if (UVTextureAnimator) { //如果运行模式不是外部指定的 if (UVTextureAnimator.RunMode == EffectRunMode.OutSiedePointed) { UVTextureAnimator.SetMaterialInstance(mats); UVTextureAnimator.Play(); } } if (UVScroll) { //如果运行模式不是外部指定的 if (UVScroll.RunMode == EffectRunMode.OutSiedePointed) { UVScroll.SetMaterialInstance(mats); UVScroll.Play(); } } }
void PlayMaterialControl() { //把材质设置进动画里 if (FadeInOutMaterialColor) { //如果运行模式不是外部指定的 if (FadeInOutMaterialColor.RunMode == EffectRunMode.OutSiedePointed) { FadeInOutMaterialColor.SetMaterialInstance(GenerateMaterialInstance()); FadeInOutMaterialColor.Play(); } } if (FadeInOutMaterialFloat) { //如果运行模式不是外部指定的 if (FadeInOutMaterialFloat.RunMode == EffectRunMode.OutSiedePointed) { FadeInOutMaterialFloat.SetMaterialInstance(GenerateMaterialInstance()); FadeInOutMaterialFloat.Play(); } } if (UVTextureAnimator) { //如果运行模式不是外部指定的 if (UVTextureAnimator.RunMode == EffectRunMode.OutSiedePointed) { UVTextureAnimator.SetMaterialInstance(GenerateMaterialInstance()); UVTextureAnimator.Play(); } } if (UVScroll) { //如果运行模式不是外部指定的 if (UVScroll.RunMode == EffectRunMode.OutSiedePointed) { UVScroll.SetMaterialInstance(GenerateMaterialInstance()); UVScroll.Play(); } } if (GradientColor) { //如果运行模式不是外部指定的 if (GradientColor.RunMode == EffectRunMode.OutSiedePointed) { GradientColor.SetMaterialInstance(GenerateMaterialInstance()); GradientColor.Play(); } } }
void Finish() { if (!bInit) { return; } if (EffectNode.UseTestModel) { return; } if (matInstances.Count <= 0) { return; } //结束的时候,还原材质球 foreach (Renderer r in m_Renders) { if (!r) { continue; } //只还原第0个材质球 if (OrginalmatMap.ContainsKey(r)) { Material[] mats = r.sharedMaterials; EffectUtily.GabageRender(r, mats[0]); mats[0] = OrginalmatMap[r]; r.materials = mats; } } matInstances.Clear(); //清空动画 if (FadeInOutMaterialColor) { //如果运行模式不是外部指定的 if (FadeInOutMaterialColor.RunMode == EffectRunMode.OutSiedePointed) { FadeInOutMaterialColor.SetMaterialInstance(matInstances); FadeInOutMaterialColor.Stop(); } } if (FadeInOutMaterialFloat) { //如果运行模式不是外部指定的 if (FadeInOutMaterialFloat.RunMode == EffectRunMode.OutSiedePointed) { FadeInOutMaterialFloat.SetMaterialInstance(matInstances); FadeInOutMaterialFloat.Stop(); } } if (UVTextureAnimator) { //如果运行模式不是外部指定的 if (UVTextureAnimator.RunMode == EffectRunMode.OutSiedePointed) { UVTextureAnimator.SetMaterialInstance(matInstances); UVTextureAnimator.Stop(); } } if (UVScroll) { //如果运行模式不是外部指定的 if (UVScroll.RunMode == EffectRunMode.OutSiedePointed) { UVScroll.SetMaterialInstance(matInstances); UVScroll.Stop(); } } if (GradientColor) { //如果运行模式不是外部指定的 if (GradientColor.RunMode == EffectRunMode.OutSiedePointed) { GradientColor.SetMaterialInstance(matInstances); GradientColor.Stop(); } } }
void Finish() { if (!bInit) { return; } if (EffectNode.UseTestModel) { return; } if (matInstances.Count <= 0) { return; } List <Material> TempList = new List <Material>(); //结束的时候,清楚新增的材质球 foreach (Renderer r in m_Renders) { if (!r) { continue; } if (matInstancesMap.ContainsKey(r)) { TempList.Clear(); Material[] materials = r.sharedMaterials; TempList.AddRange(r.sharedMaterials); TempList.Remove(matInstancesMap[r]); r.sharedMaterials = TempList.ToArray(); EffectUtily.GabageRender(r, matInstancesMap[r]); var temp1 = matInstancesMap[r]; ResNode.DestroyRes(ref temp1); } } matInstances.Clear(); matInstancesMap.Clear(); //清空动画 if (FadeInOutMaterialColor) { //如果运行模式不是外部指定的 if (FadeInOutMaterialColor.RunMode == EffectRunMode.OutSiedePointed) { FadeInOutMaterialColor.SetMaterialInstance(matInstances); FadeInOutMaterialColor.Stop(); } } if (FadeInOutMaterialFloat) { //如果运行模式不是外部指定的 if (FadeInOutMaterialFloat.RunMode == EffectRunMode.OutSiedePointed) { FadeInOutMaterialFloat.SetMaterialInstance(matInstances); FadeInOutMaterialFloat.Stop(); } } if (UVTextureAnimator) { //如果运行模式不是外部指定的 if (UVTextureAnimator.RunMode == EffectRunMode.OutSiedePointed) { UVTextureAnimator.SetMaterialInstance(matInstances); UVTextureAnimator.Stop(); } } if (UVScroll) { //如果运行模式不是外部指定的 if (UVScroll.RunMode == EffectRunMode.OutSiedePointed) { UVScroll.SetMaterialInstance(matInstances); UVScroll.Stop(); } } if (GradientColor) { //如果运行模式不是外部指定的 if (GradientColor.RunMode == EffectRunMode.OutSiedePointed) { GradientColor.SetMaterialInstance(matInstances); GradientColor.Stop(); } } }