Exemplo n.º 1
0
 void Update()
 {
     ColorUpdate();
     if (m_colorIndex >= 0 && m_colorMan != null && m_colSave != m_col)
     {
         m_colSave = m_col;
         m_colorMan.SetColor(m_colorIndex, m_col);
         //m_colorMan.Apply();
     }
 }
Exemplo n.º 2
0
        IEnumerator FX_COL_sub(hglParser.Element e, string mode, Color dst, float speed)
        {
            int index = -1;

            switch (mode)
            {
            case "main":  index = e.colorIndex;      break;

            case "back":  index = e.backcolorIndex;  break;

            case "frame": index = e.frameColorIndex; break;

            case "effect": index = e.effectColorIndex; break;
            }
            if (index < 0)
            {
                yield break;
            }

            hglHtmlColor htmlColor = null;
            {
                var render = m_renderInfo.GetRender();
                htmlColor = render.m_render.m_htmlColor;
            }

            Vector3 startColor = hglEtc.toVector3(htmlColor.GetColor(index));
            Vector3 endColor   = hglEtc.toVector3(dst);

            float i = 0;

            while (true)
            {
                yield return(null);

                i += speed * Time.deltaTime;
                float h   = 0.5f + 0.5f * Mathf.Sin(i * Mathf.Deg2Rad);
                var   cur = Vector3.Lerp(startColor, endColor, h);
                htmlColor.SetColor(index, hglEtc.toColor(cur));
            }
        }
Exemplo n.º 3
0
    IEnumerator Start()
    {
        yield return(new WaitForSeconds(5));

        m_list     = new List <Color>();
        m_savelist = new List <Color>();

        var renderobj = hgca.Find("Renderer").GetComponent <hglHtmlRender>();

        m_htmlColor = renderobj.m_render.m_htmlColor;

        for (int i = 0; i < m_htmlColor.CountIndex(); i++)
        {
            m_list.Add(m_htmlColor.GetColor(i));
            m_savelist.Add(m_htmlColor.GetColor(i));
        }

        while (true)
        {
            yield return(new WaitForSeconds(0.5f));

            bool bDirty = false;
            for (int i = 0; i < m_list.Count; i++)
            {
                if (m_list[i] != m_savelist[i])
                {
                    bDirty        = true;
                    m_savelist[i] = m_list[i];
                    m_htmlColor.SetColor(i, m_list[i]);
                }
            }
            if (bDirty)
            {
                m_htmlColor.Apply();
            }
        }
    }
Exemplo n.º 4
0
        IEnumerator FX_ALFA_sub(hglParser.Element e, string mode, float speed)
        {
            if (e.mode == hglParser.Mode.TAG && e.text == "img" && e.bone1.renderer != null)
            {
                var   mat = e.bone1.renderer.material;
                float i   = 0;
                while (true)
                {
                    yield return(null);

                    i += speed * Time.deltaTime;
                    float h = 0.5f + 0.5f * Mathf.Cos(i * Mathf.Deg2Rad);
                    mat.SetFloat("_Alpha1", h);
                }
            }
            else if (e.mode == hglParser.Mode.TAG && e.text == "body")
            {
                var   mat = m_renderInfo.GetRender().renderer.material;
                float i   = 0;
                while (true)
                {
                    yield return(null);

                    i += speed * Time.deltaTime;
                    float h = 0.5f + 0.5f * Mathf.Cos(i * Mathf.Deg2Rad);
                    mat.SetFloat("_Alpha", h);
                }
            }
            else
            {
                int index = -1;
                switch (mode)
                {
                case "main":  index = e.colorIndex;      break;

                case "back":  index = e.backcolorIndex;  break;

                case "frame": index = e.frameColorIndex; break;

                case "effect": index = e.effectColorIndex; break;
                }
                if (index < 0)
                {
                    yield break;
                }

                hglHtmlColor htmlColor = null;
                {
                    var render = m_renderInfo.GetRender();
                    htmlColor = render.m_render.m_htmlColor;
                }

                var   col = htmlColor.GetColor(index);
                float i   = 0;
                while (true)
                {
                    yield return(null);

                    i += speed * Time.deltaTime;
                    float h = 0.5f + 0.5f * Mathf.Cos(i * Mathf.Deg2Rad);
                    col.a = h;
                    htmlColor.SetColor(index, col);
                }
            }
        }