Пример #1
0
    private void FixedUpdate()
    {
        if (_isAllowedToMove)
        {
            float horizontal = Input.GetAxis("Horizontal");
            float vertical   = Input.GetAxis("Vertical");

            bool longHit  = Input.GetMouseButton(0);
            bool block    = Input.GetMouseButton(1);
            bool quickHit = Input.GetMouseButtonDown(2);

            _movementController.UpdatePosition(horizontal, vertical);
            _movementController.UpdateRotation();

            if (quickHit && _chars.Stamina >= -S_PUNISH_QUICK_HIT)
            {
                _animationController.ActivateTrigger(AnimatorStates.QuickHit);
                BlockStamina();
            }
            else if (longHit && _chars.Stamina >= -S_PUNISH_LONG_HIT_N_FINISHED)
            {
                _animationController.ActivateTrigger(AnimatorStates.StartLong);
                BlockStamina();
            }
            else if (_longHitLastFrame && !longHit)
            {
                if (_longHitReady)
                {
                    if (_chars.Stamina >= -S_PUNISH_LONG_HIT_FINISHED)
                    {
                        _animationController.ActivateTrigger(AnimatorStates.ProceedLong);
                    }
                    else
                    {
                        _animationController.ActivateTrigger(AnimatorStates.CancelLong);
                    }

                    BlockStamina();
                }
                else
                {
                    _animationController.ActivateTrigger(AnimatorStates.CancelLong);
                }
                _longHitReady = false;
            }

            if (block && _chars.Stamina >= S_PUNISH_BLOCK)
            {
                _animationController.ActivateTrigger(AnimatorStates.Block);
                BlockStamina();
            }

            _longHitLastFrame = longHit;

            if (Input.GetKeyDown(KeyCode.Space))
            {
                _eventHandler.CallHearers();
            }
        }
    }