Beispiel #1
0
        Color GetEmissiveColor(Material mat)
        {
            Color emis = new Color();
            Color glow = new Color();

            if (mat.IsKeywordEnabled("_EMISSION") && mat.HasProperty(DissolveHelper.emissionColorID))
            {
                emis += mat.GetColor(DissolveHelper.emissionColorID);
            }

            float dissolveAmount = DissolveHelper.GetDissolveAmount(mat);

            if (mat.IsKeywordEnabled("_DISSOLVEGLOW_ON"))
            {
                float multiplier = Mathf.Max(0f, (m_GlowCutoff - dissolveAmount));
                glow  = DissolveHelper.GetDissolveGlowColor(mat) * DissolveHelper.GetDissolveGlowIntensity(mat) * 10f * Mathf.Clamp01(dissolveAmount);
                glow *= multiplier;

                if (!mat.IsKeywordEnabled("_SUBMAP"))
                {
                    emis *= multiplier;
                }
            }

            emis += glow;

            return(emis);
        }
Beispiel #2
0
        public void TriggerDissolve(bool atomic, bool disableAfterDissolve, AnimationCurve dissolveCurve, float dissolveStartPercent, float time, float speed)
        {
            if ((atomic && m_Dissolving) || !m_CanDissolve)
            {
                return;
            }

            if (m_Materials != null && m_Materials.Length > 0)
            {
                m_Dissolving = true;
                InvokeDissolveStartEvents();
                StartCoroutine(DissolveHelper.CurveDissolve(m_Materials, dissolveCurve, time, dissolveStartPercent, speed, () => {
                    m_Dissolving = false;
                    InvokeDissolveEndEvents();
                }));
            }

            if (disableAfterDissolve)
            {
                m_CanDissolve = false;
            }
        }
        public void TriggerDissolve(float time, float dissolveStartPercent, float speed)
        {
            if (atomic && m_Dissolving)
            {
                return;
            }

            if (m_Materials != null && m_Materials.Length > 0)
            {
                if (!(oneTime && m_Dissolving))
                {
                    m_Dissolving = true;

                    if (m_CurrentCoroutine != null)
                    {
                        StopCoroutine(m_CurrentCoroutine);
                    }

                    m_CurrentCoroutine = DissolveHelper.CurveDissolve(m_Materials, dissolveCurve, time, dissolveStartPercent, speed);
                    StartCoroutine(YieldDissolve(m_CurrentCoroutine));
                }
            }
        }