예제 #1
0
    public void StartFadeTo(int _fadeTo)
    {
        switch ((FADETO)_fadeTo)
        {
        case FADETO.IN:
            m_FadeToValue = m_Size;
            m_FadeState   = FADETO.IN;
            break;

        case FADETO.OUT:
            m_FadeToValue = m_DefaultSize;
            m_FadeState   = FADETO.OUT;
            break;
        }
    }
예제 #2
0
    // Update is called once per frame
    protected void Update()
    {
        if (m_FadeState != FADETO.NONE)
        {
            if (m_Axis == AXIS.X)
            {
                m_PanelTransform.sizeDelta = Vector2.Lerp(m_PanelTransform.sizeDelta, new Vector2(m_FadeToValue, m_PanelTransform.sizeDelta.y), Time.deltaTime * m_FadeSpeed);
            }
            else
            {
                m_PanelTransform.sizeDelta = Vector2.Lerp(m_PanelTransform.sizeDelta, new Vector2(m_PanelTransform.sizeDelta.x, m_FadeToValue), Time.deltaTime * m_FadeSpeed);
            }

            if (Mathf.Abs(m_PanelTransform.sizeDelta.x - m_FadeToValue) < 0.01f)
            {
                m_FadeState = FADETO.NONE;
            }
        }
    }