Пример #1
0
    void Update()
    {
        switch (m_state)
        {
        case State.Normal:
        {
            if (!m_role.IsAlive())
            {
                m_elapsedTime = 0;
                m_state       = State.Deading;
            }
            else
            {
                UpdateNormal();
            }
        }
        break;

        case State.Deading:
        {
            m_elapsedTime += Time.deltaTime;
            if (m_elapsedTime > 2.5f)
            {
                m_state = State.Dead;
            }
        }
        break;

        case State.Dead:
        {
        }
        break;

        case State.Revive:
        {
            m_elapsedTime += Time.deltaTime;
            if (m_elapsedTime > 2.0f)
            {
                m_role.AddHp(m_role.m_maxHp);
                m_state = State.Normal;
            }
        }
        break;

        default:
            break;
        }
    }