// Update is called once per frame
    private void Update()
    {
        _animator.SetBool("inMotion", !_body.IsSleeping());

        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            _animator.Play(_weaponController.GetWeaponAnimation());
            _weaponController.Attack();
        }
        else if (Input.GetKeyDown(KeyCode.Mouse1))
        {
            _animator.Play("characterBlocking");
        }
        else if (Input.GetKeyDown(KeyCode.Z))
        {
            _animator.Play("characterMentalBreakdown");
        }
    }
Пример #2
0
    protected void TryAttack()
    {
        if (!TargetInRange())
        {
            m_currentState = CurrentState.Moving;
            return;
        }

        m_timeSinceLastAttack += Time.deltaTime;

        if (CheckCanAttack())
        {
            m_timeSinceLastAttack -= m_currentStats.attackSpeed; //Keep any leftover time to not punish bad devices
            m_weaponControls.Attack();
        }
        else
        {
            m_weaponControls.ReadyWeapon();
        }
    }