예제 #1
0
        public void Play()
        {
            Init();


            if (!mInited)
            {
                return;
            }

            //场景切换,会删除Go,所以要检查
            if (mMeshObj == null)
            {
                InitMeshObj();
                return;
            }

            //gameObject.SetActive(true);
            if (mMeshObj != null)
            {
                mMeshObj.SetActive(true);
            }

            //如果开始的点太远,重置一遍,因为光效优化的位置是在99999
            //if (mSnapshotList[0].PointStart.sqrMagnitude > 100000000 ||
            //    mSnapshotList[0].PointEnd.sqrMagnitude > 100000000 ||
            //    RelaryLifeFrame != LifeFrame)
            //{
            //RelaryLifeFrame = LifeFrame;
            InitOriginalElements();
            InitSpline();
            // }

            mFadeT          = 1f;
            mIsFading       = false;
            mFadeTime       = 1f;
            mFadeElapsedime = 0f;
            mElapsedTime    = 0f;

            //重置
            for (int i = 0; i < mSnapshotList.Count; i++)
            {
                mSnapshotList[i].PointStart = PointStart.position;
                mSnapshotList[i].PointEnd   = PointEnd.position;

                //mSpline.ControlPoints[i].Position = mSnapshotList[i].Pos;
                //mSpline.ControlPoints[i].Normal = mSnapshotList[i].PointEnd - mSnapshotList[i].PointStart;
            }

            //重置
            RefreshSpline();
            UpdateVertex();
            GenerateMaterialInstance();
            UpdateMaterial();
            PlayMaterialControl();
            EffectUtily.DispatchRender(m_Render, m_Render.sharedMaterial);

            mVertexPool.LateUpdate();
            bActive = true;
        }
예제 #2
0
        /// <summary>
        /// 计算材质球实例,如果有多个render,会返回多个材质球实例
        /// </summary>
        /// <returns></returns>
        private void GenrateMaterialInstance()
        {
            if (!bInit)
            {
                return;
            }

            if (matInstances.Count <= 0)
            {
                Material instanceMat;

                //替换Render上的材质球
                foreach (Renderer r in m_Renders)
                {
                    if (!r)
                    {
                        continue;
                    }

                    //只替换第0个材质球
                    Material[] mats = r.materials;
                    r.material  = TargetMaterial;
                    instanceMat = r.material;
                    mats[0]     = instanceMat;
                    r.materials = mats;

                    if (!matInstances.Contains(instanceMat))
                    {
                        matInstances.Add(instanceMat);
                        EffectUtily.DispatchRender(r, instanceMat);
                    }
                }
            }
        }
예제 #3
0
        public void Stop()
        {
            if (!bInit)
            {
                return;
            }
            bPlay            = false;
            lastRealDistance = 0.0f;
            //lastVertexCount = 0;
            foreach (Material m in m_LineRender.materials)
            {
                EffectUtily.GabageRender(m_LineRender, m);
            }
            m_LineRender.enabled = false;

            if (useMultiColor)
            {
                foreach (LineRenderer line in m_subLineRenders)
                {
                    foreach (Material m in line.materials)
                    {
                        EffectUtily.GabageRender(line, m);
                    }
                    line.enabled = false;
                }
            }
            StopMaterialControl();
        }
예제 #4
0
        public void OnDestroy()
#endif
        {
            if (UseSharedMaterial)
            {
                if (RunMode == EffectRunMode.Self)
                {
                    foreach (Renderer r in RenderList)
                    {
                        if (!r.sharedMaterial)
                        {
                            continue;
                        }
                        EffectUtily.GabageRender(r, r.sharedMaterial);
                        if (!r.sharedMaterial.HasProperty(TexturePropertyName))
                        {
                            continue;
                        }
                        Vector2 uv;
                        orginalUVScroll.TryGetValue(r.sharedMaterial, out uv);
                        r.sharedMaterial.SetTextureOffset(TexturePropertyName, uv);
                    }
                }
            }


            matInstances.Clear();
            matInstances = null;
            RenderList.Clear();
            RenderList = null;
        }
예제 #5
0
        public void OnDestroy()
        {
            if (RunMode != EffectRunMode.Self)
            {
                return;
            }

            if (UseSharedMaterial)
            {
                if (null != m_Renders && m_Renders.Length > 0)
                {
                    for (int i = 0; i < m_Renders.Length; i++)
                    {
                        Renderer r = m_Renders[i];
                        if (!r.sharedMaterial)
                        {
                            continue;
                        }
                        EffectUtily.GabageRender(r, r.sharedMaterial);
                        r.sharedMaterial.SetColor(ColorName, OrginalColorMap[r.sharedMaterial]);
                    }
                }
            }

            OrginalColorMap.Clear();
            m_Renders    = null;
            m_Projectors = null;
            matInstances.Clear();
        }
예제 #6
0
        public void OnDestroy()
        {
            if (UseSharedMaterial)
            {
                if (m_Renders != null && RunMode == EffectRunMode.Self)
                {
                    if (m_Renders.Length > 0)
                    {
                        for (int i = 0; i < m_Renders.Length; i++)
                        {
                            Renderer r = m_Renders[i];
                            if (!r.sharedMaterial)
                            {
                                continue;
                            }
                            EffectUtily.GabageRender(r, r.sharedMaterial);
                            r.sharedMaterial.SetTextureScale(TexturePropertyName, OrginalScale[r.sharedMaterial]);
                        }
                    }
                }
            }


            OrginalScale.Clear();
            matInstances.Clear();
            matInstances = null;

            m_Renders    = null;
            m_Projectors = null;
        }
예제 #7
0
 private void ChangeUseModeUV()
 {
     if (matInstances.Count > 0)
     {
         foreach (Material mat in matInstances)
         {
             if (!mat)
             {
                 continue;
             }
             if (UseModelUV)
             {
                 mat.EnableKeyword("USE_MODE_UV_ON");
                 mat.DisableKeyword("USE_MODE_UV_OFF");
                 EffectUtily.UpdateKeyWorld(mat, "USE_MODE_UV_ON", true);
                 EffectUtily.UpdateKeyWorld(mat, "USE_MODE_UV_OFF", false);
             }
             else
             {
                 mat.EnableKeyword("USE_MODE_UV_OFF");
                 mat.DisableKeyword("USE_MODE_UV_ON");
                 EffectUtily.UpdateKeyWorld(mat, "USE_MODE_UV_ON", false);
                 EffectUtily.UpdateKeyWorld(mat, "USE_MODE_UV_OFF", true);
             }
         }
     }
     OldUseModelUV = UseModelUV;
 }
 private void InitDefaultVariables_Constant()
 {
     foreach (Material mat in matInstances)
     {
         if (!mat)
         {
             continue;
         }
         float val = 0.0f;
         if (FadeInDuartion > 0.03f)
         {
             val = FadeInFrom;
         }
         else if (FadeOutDuartion > 0.03f)
         {
             val = FadeOutFrom;
         }
         Color c = OrginalColorMap[mat] * val;
         if (!FadeAlpha)
         {
             c.a = OrginalColorMap[mat].a;
         }
         mat.SetColor(ColorName, c);
         EffectUtily.UpdateColor(mat, ColorName, c);
     }
 }
예제 #9
0
        /// <summary>
        /// 分发网格,分发到对应的glow、DissloveGlow、GlowOutLine中
        /// </summary>
        public static EffectDispatchResult DispatchMesh(Mesh m, Matrix4x4 matrix, Material mat, int layer = -1)
        {
            if (!mat)
            {
                return(EffectDispatchResult.Dispatch_None);
            }

            if (layer != -1)
            {
                if (layer != LayerMask.NameToLayer(Config.LayerLightingEffectOnly))
                {
                    return(EffectDispatchResult.Dispatch_None);
                }
            }

            if (!EffectUtily.DispatchMeshToGlow(m, matrix, mat))
            {
                if (!EffectUtily.DispatchMeshToDissolveGlow(m, matrix, mat))
                {
                    if (EffectUtily.DispatchMeshToGlowOutLine(m, matrix, mat))
                    {
                        return(EffectDispatchResult.Dispatch_GlowOutLine);
                    }
                    return(EffectDispatchResult.Dispatch_None);
                }
                return(EffectDispatchResult.Dispatch_DissloveGlow);
            }
            return(EffectDispatchResult.Diapatch_Glow);
        }
        void Update_Curve()
        {
            if (!bCanElvate)
            {
                return;
            }
            if (currDuatrtion < curve_DuartionTime)
            {
                currDuatrtion += Time.deltaTime;
                float time = currDuatrtion / curve_DuartionTime;
                float v    = curve.Evaluate(time);
                v *= curveScale;
                Color CurrentColor;
                foreach (Material mat in matInstances)
                {
                    if (!mat)
                    {
                        continue;
                    }
                    CurrentColor = OrginalColorMap[mat];
                    bool bNeedToUpdateColor = false;
                    if (FadeAlpha)
                    {
                        CurrentColor.a    *= v;
                        bNeedToUpdateColor = true;
                    }

                    if (FadeColor)
                    {
                        CurrentColor.r    *= v;
                        CurrentColor.b    *= v;
                        CurrentColor.g    *= v;
                        bNeedToUpdateColor = true;
                    }

                    if (bNeedToUpdateColor)
                    {
                        mat.SetColor(ColorName, CurrentColor);
                        EffectUtily.UpdateColor(mat, ColorName, CurrentColor);
                    }
                }
            }
            else
            {
                Stop_Curve();
                if (Loop)
                {
                    Reset_Curve();
                }
                else
                {
                    bPlay = false;
                    InvokeFinishEvent();
                }
            }
        }
예제 #11
0
        private void InitMaterial()
        {
            if (matInstances.Count > 0)
            {
                return;
            }

            if (m_Renders.Length > 0)
            {
                for (int i = 0; i < m_Renders.Length; i++)
                {
                    Renderer r = m_Renders[i];
                    if (!r.sharedMaterial)
                    {
                        continue;
                    }
                    if (RunMode == EffectRunMode.Self)
                    {
                        if (UseSharedMaterial)
                        {
                            matInstances.Add(r.sharedMaterial);
                            EffectUtily.DispatchRender(r, r.sharedMaterial, i);
                            OrginalScale.Add(r.sharedMaterial, r.sharedMaterial.GetTextureScale(TexturePropertyName));
                        }
                        else
                        {
                            matInstances.Add(r.material);
                            EffectUtily.DispatchRender(r, r.material, i);
                        }
                    }
                }
            }
            else
            {
                if (m_Projectors.Length > 0)
                {
                    //Debug.LogWarning("不支持分发渲染器,以后会实现");
                    foreach (Projector r in m_Projectors)
                    {
                        if (!r.material)
                        {
                            continue;
                        }
                        if (!r.material.name.EndsWith("(Instance)"))
                        {
                            r.material = new Material(r.material)
                            {
                                name = r.material.name + " (Instance)"
                            };
                        }
                        matInstances.Add(r.material);
                    }
                }
            }
        }
예제 #12
0
        public void Play()
        {
            if (!bInit)
            {
                return;
            }
            bPlay = true;

            if (RunMode == EffectRunMode.Self)
            {
                if (!ApplyLocal())
                {
                    return;
                }
            }
            else if (RunMode == EffectRunMode.OutSiedePointed)
            {
                if (!ApplyGlobal())
                {
                    return;
                }
            }
            else
            {
                return;
            }

            m_LineRender.enabled = true;
            foreach (Material m in m_LineRender.materials)
            {
                EffectUtily.DispatchRender(m_LineRender, m);
            }

            if (useMultiColor)
            {
                m_LineRender.enabled = false;
                foreach (LineRenderer line in m_subLineRenders)
                {
                    line.enabled = true;
                    //line.materials = m_LineRender.materials;
                    foreach (Material m in line.materials)
                    {
                        EffectUtily.DispatchRender(line, m);
                    }
                }
            }

            PlayMaterialControl();
            bPlay = true;
        }
예제 #13
0
 /// <summary>
 /// 回收渲染器,从glow、DissloveGlow、GlowOutLine中回收渲染器
 /// </summary>
 void GabageRender()
 {
     foreach (KeyValuePair <Renderer, Material> r in m_DispatchedRender)
     {
         if (!EffectUtily.GabageRenderFromGlow(r.Key, r.Value))
         {
             if (!EffectUtily.GabageRenderFromDissolveGlow(r.Key, r.Value))
             {
                 EffectUtily.GabageRenderFromGlowOutLine(r.Key, r.Value);
             }
         }
     }
     m_DispatchedRender.Clear();
 }
예제 #14
0
 /// <summary>
 /// 回收渲染器,从glow、DissloveGlow、GlowOutLine中回收渲染器
 /// </summary>
 public static void GabageRender(Renderer r, Material mat)
 {
     if (!r)
     {
         return;
     }
     if (!EffectUtily.GabageRenderFromGlow(r, mat))
     {
         if (!EffectUtily.GabageRenderFromDissolveGlow(r, mat))
         {
             EffectUtily.GabageRenderFromGlowOutLine(r, mat);
         }
     }
 }
예제 #15
0
        public void Stop()
        {
            if (!bInit)
            {
                return;
            }

            if (HostGo)
            {
                HostGo.SetActive(false);
            }
            EffectUtily.GabageRender(hostRender, hostRender.sharedMaterial);
            StopMaterialControl();
        }
예제 #16
0
        private void InitDefaultVariables_Curve()
        {
            foreach (Material mat in matInstances)
            {
                if (!mat)
                {
                    continue;
                }
                float val = curve.Evaluate(0) * curveScale;

                mat.SetFloat(PropertyName, val);
                EffectUtily.UpdateFloat(mat, PropertyName, val);
            }
        }
예제 #17
0
 private void InitDefaultVariables()
 {
     if (null == matInstances || matInstances.Count <= 0)
     {
         return;
     }
     foreach (Material mat in matInstances)
     {
         if (!mat)
         {
             continue;
         }
         mat.SetColor(ColorName, OrginalColorMap[mat]);
         EffectUtily.UpdateColor(mat, ColorName, OrginalColorMap[mat]);
     }
 }
        public void ReStartFadeOutFinish()
        {
            if (FadeOutDuartion <= 0.03f)
            {
                currentFloat = Mathf.Lerp(FadeOutFrom, FadeOutTo, FadeTimer / FadeOutDuartion);
                Color CurrentColor;
                foreach (Material mat in matInstances)
                {
                    CurrentColor = OrginalColorMap[mat];
                    bool bNeedToUpdateColor = false;
                    if (FadeAlpha)
                    {
                        CurrentColor.a    *= currentFloat;
                        bNeedToUpdateColor = true;
                    }

                    if (FadeColor)
                    {
                        CurrentColor.r    *= currentFloat;
                        CurrentColor.b    *= currentFloat;
                        CurrentColor.g    *= currentFloat;
                        bNeedToUpdateColor = true;
                    }

                    if (bNeedToUpdateColor)
                    {
                        mat.SetColor(ColorName, CurrentColor);
                        EffectUtily.UpdateColor(mat, ColorName, CurrentColor);
                    }
                }

                InvokeFinishEvent();
                canDoFadeOut = false;
                return;
            }

            if (canDoFadeOut)
            {
                if (null != fadeOutFinish)
                {
                    StopCoroutine(fadeOutFinish);
                }
                fadeOutFinish = GameUtil.StartCoroutineHelper(this, WaitForFadeOutFinsh_Constant());
                return;
            }
        }
예제 #19
0
        private void UpdateCorutineFrame()
        {
            if (matInstances.Count <= 0 || !bPlay)
            {
                return;
            }

            ++allCount;
            if (IsReverse)
            {
                --index;
            }
            else
            {
                ++index;
            }
            if (index >= count)
            {
                index = 0;
            }

            Vector2 offset;

            if (IsRandomOffsetForInctance)
            {
                var idx = index + OffsetMat;
                offset = new Vector2((float)idx / Columns - (idx / Columns),
                                     1 - (idx / Columns) / (float)Rows);
            }
            else
            {
                offset = new Vector2((float)index / Columns - (index / Columns),
                                     1 - (index / Columns) / (float)Rows);
            }

            foreach (Material mat in matInstances)
            {
                mat.SetTextureOffset(TexturePropertyName, offset);
                EffectUtily.UpdateUVAnimation(mat, TexturePropertyName, offset);
            }

            if (OldUseModelUV != UseModelUV)
            {
                ChangeUseModeUV();
            }
        }
예제 #20
0
        public void Play(int entityID)
        {
            if (!bInit)
            {
                return;
            }
            if (HostCamera)
            {
                if (Initialize.isOnGameRuning && SceneManager.Instance)
                {
                    if (GameLogicAPI.isMainMap(SceneManager.Instance.m_curMapID))
                    {
                        Vector3 refPos           = Vector3.zero;
                        U3D_Render.EntityView ev = EntityFactory.getEntityViewByID(entityID);
                        if (ev != null && ev.StateMachine)
                        {
                            refPos = ev.StateMachine.transform.position;
                            //距离太远,不播放
                            if (GameUtil.GetSqrDistanceWithOutY(refPos, HostCamera.transform.position) > 200)
                            {
                                return;
                            }
                        }
                    }
                }
            }
            LateUpdate();

            if (HostGo)
            {
                HostGo.SetActive(true);
            }

            if (RandomPos)
            {
                UpdateScreenPos();

                CorrectPos.x = Random.Range(posMin.x, posMax.x);
                CorrectPos.y = Random.Range(posMin.y, posMax.y);
            }

            EffectUtily.DispatchRender(hostRender, hostRender.sharedMaterial);
            PlayMaterialControl();
        }
예제 #21
0
        public void Update()
        {
            if (!bPlay)
            {
                return;
            }

            if (matInstances.Count <= 0)
            {
                bPlay = false;
                return;
            }

            if (!bCanElvate)
            {
                return;
            }
            if (currDuatrtion < DuartionTime)
            {
                currDuatrtion += Time.deltaTime;
                float time         = currDuatrtion / DuartionTime;
                Color CurrentColor = gradColor.Evaluate(time);
                foreach (Material mat in matInstances)
                {
                    if (!mat)
                    {
                        continue;
                    }
                    mat.SetColor(ColorName, CurrentColor);
                    EffectUtily.UpdateColor(mat, ColorName, CurrentColor);
                }
            }
            else
            {
                if (Loop)
                {
                    ResetValue();
                }
                else
                {
                    Stop();
                }
            }
        }
        private void InitDefaultVariables_Curve()
        {
            foreach (Material mat in matInstances)
            {
                if (!mat)
                {
                    continue;
                }
                float val = curve.Evaluate(0) * curveScale;

                Color c = OrginalColorMap[mat] * val;
                if (!FadeAlpha)
                {
                    c.a = OrginalColorMap[mat].a;
                }
                mat.SetColor(ColorName, c);
                EffectUtily.UpdateColor(mat, ColorName, c);
            }
        }
예제 #23
0
        public void GenerateSelfMaterial()
        {
            matInstances.Clear();

            if (IncludeChildren)
            {
                RenderList.AddRange(GetComponentsInChildren <Renderer>());
            }
            else
            {
                RenderList.AddRange(GetComponents <Renderer>());
            }
            for (int i = 0; i < RenderList.Count; i++)
            {
                Renderer r = RenderList[i];
                if (!r.sharedMaterial)
                {
                    continue;
                }
                if (!r.sharedMaterial.HasProperty(TexturePropertyName))
                {
                    Debug.LogWarning("物体:" + gameObject.name + "的材质球:" + r.sharedMaterial.name + "没有属性:" + TexturePropertyName);
                    continue;
                }
                if (RunMode == EffectRunMode.Self)
                {
                    if (UseSharedMaterial)
                    {
                        matInstances.Add(r.sharedMaterial);
                        EffectUtily.DispatchRender(r, r.sharedMaterial);
                        orginalUVScroll.Add(r.sharedMaterial, r.sharedMaterial.GetTextureOffset(TexturePropertyName));
                    }
                    else
                    {
                        matInstances.Add(r.material);
                        EffectUtily.DispatchRender(r, r.material);
                    }
                }
            }
            ChangeUseModeUV();
        }
예제 #24
0
        /// <summary>
        /// 分发渲染器,分发到对应的glow、DissloveGlow、GlowOutLine中
        /// </summary>
        public static EffectDispatchResult DispatchRender(Renderer r, Material mat, int subMeshIndex = 0)
        {
            if (!r)
            {
                return(EffectDispatchResult.Dispatch_None);
            }

            if (!EffectUtily.DispatchRenderToGlow(r, mat, subMeshIndex))
            {
                if (!EffectUtily.DispatchRenderToDissolveGlow(r, mat, subMeshIndex))
                {
                    if (EffectUtily.DispatchRenderToGlowOutLine(r, mat, subMeshIndex))
                    {
                        return(EffectDispatchResult.Dispatch_GlowOutLine);
                    }
                    return(EffectDispatchResult.Dispatch_None);
                }
                return(EffectDispatchResult.Dispatch_DissloveGlow);
            }
            return(EffectDispatchResult.Diapatch_Glow);
        }
예제 #25
0
        public void Stop()
        {
            if (!mInited)
            {
                return;
            }
            //InitOriginalElements();
            //InitSpline();

            //gameObject.SetActive(false);
            if (mMeshObj != null)
            {
                mMeshObj.SetActive(false);
            }
            bActive = false;

            EffectUtily.GabageRender(m_Render, m_Render.sharedMaterial);

            ClearMaterialInstance();
            StopMaterialControl();
        }
예제 #26
0
        void InitDefaultVariables_Constant()
        {
            foreach (Material mat in matInstances)
            {
                if (!mat)
                {
                    continue;
                }
                float val = 0.0f;
                if (FadeInDuartion > 0.03f)
                {
                    val = FadeInFrom;
                }
                else if (FadeOutDuartion > 0.03f)
                {
                    val = FadeOutFrom;
                }

                mat.SetFloat(PropertyName, val);
                EffectUtily.UpdateFloat(mat, PropertyName, val);
            }
        }
예제 #27
0
        /// <summary>
        /// 计算材质球实例,如果有多个render,会返回多个材质球实例
        /// </summary>
        /// <returns></returns>
        private void GenrateMaterialInstance()
        {
            if (!bInit)
            {
                return;
            }
            if (matInstances.Count <= 0)
            {
                Material instanceMat;

                //在Render上增加一个材质球
                foreach (Renderer r in m_Renders)
                {
                    if (!r)
                    {
                        continue;
                    }
                    if (!matInstancesMap.ContainsKey(r))
                    {
                        Material[] materials = r.sharedMaterials;
                        r.material  = TargetMaterial;
                        instanceMat = r.material;
                        int        length       = materials.Length + 1;
                        Material[] newMaterials = new Material[length];

                        materials.CopyTo(newMaterials, 0);
                        newMaterials[length - 1] = instanceMat;
                        r.sharedMaterials        = newMaterials;

                        matInstancesMap.Add(r, instanceMat);
                        matInstances.Add(instanceMat);

                        EffectUtily.DispatchRender(r, instanceMat);
                    }
                }
            }
        }
예제 #28
0
 void Update_Curve()
 {
     if (!bCanElvate)
     {
         return;
     }
     if (currDuatrtion < curve_DuartionTime)
     {
         currDuatrtion += Time.deltaTime;
         float time = currDuatrtion / curve_DuartionTime;
         float v    = curve.Evaluate(time);
         v *= curveScale;
         foreach (Material mat in matInstances)
         {
             if (!mat)
             {
                 continue;
             }
             mat.SetFloat(PropertyName, v);
             EffectUtily.UpdateFloat(mat, PropertyName, v);
         }
     }
     else
     {
         Stop_Curve();
         if (Loop)
         {
             Reset_Curve();
         }
         else
         {
             bPlay = false;
             //循环不会有完成
             InvokeFinishEvent();
         }
     }
 }
예제 #29
0
        /// <summary>
        /// 分发渲染器,分发到对应的glow、DissloveGlow、GlowOutLine中
        /// </summary>
        void DispatchRender(EffectModules modules)
        {
            foreach (Renderer r in modules.m_Normal_Renders)
            {
                if (!r)
                {
                    Debug.LogWarning(name + ",bake信息已经改变,请美术重新bake!");
                    continue;
                }

                //层级不对,一边去
                if (r.gameObject.layer != LayerMask.NameToLayer(Config.LayerLightingEffectOnly))
                {
                    continue;
                }

                Material mat = r.sharedMaterial;
                if (!EffectUtily.DispatchRenderToGlow(r, mat, 0))
                {
                    if (!EffectUtily.DispatchRenderToDissolveGlow(r, mat, 0))
                    {
                        if (EffectUtily.DispatchRenderToGlowOutLine(r, mat, 0))
                        {
                            m_DispatchedRender.Add(r, mat);
                        }
                    }
                    else
                    {
                        m_DispatchedRender.Add(r, mat);
                    }
                }
                else
                {
                    m_DispatchedRender.Add(r, mat);
                }
            }
        }
        public void ReStartFadeOutFinish_Constant()
        {
            if (FadeOutDuartion <= 0.03f)
            {
                currentFloat = FadeOutFrom;

                foreach (Material mat in matInstances)
                {
                    mat.SetFloat(PropertyName, currentFloat);
                    EffectUtily.UpdateFloat(mat, PropertyName, currentFloat);
                }
                canDoFadeOut = false;
                return;
            }
            if (canDoFadeOut)
            {
                if (null != fadeOutFinish)
                {
                    StopCoroutine(fadeOutFinish);
                }
                fadeOutFinish = GameUtil.StartCoroutineHelper(this, WaitForFadeOutFinsh());
                return;
            }
        }