예제 #1
0
    private void Blocking()
    {
        if (Input.GetButtonDown("Block"))
        {
            m_animator.SetBool("IsBlocking", true);
            m_animator?.Play("Start Blocking");
        }
        else if (Input.GetButtonUp("Block"))
        {
            m_animator?.SetBool("IsBlocking", false);
        }

        if (m_animator.GetBool("IsBlocking"))
        {
            if (!m_energy.ConsumeEnergyPerSecond(m_blockingEnergyConsumption, Time.deltaTime))
            {
                m_animator?.SetBool("IsBlocking", false);
            }
        }
    }