//Player input is read here
    private void Update()
    {
        inputDir = controls.Player.Movement.ReadValue <Vector2>();

        if (Keyboard.current.spaceKey.wasPressedThisFrame)
        {
            animCtrl.Attack();
        }

        if (Keyboard.current.eKey.wasPressedThisFrame)
        {
            animCtrl.AttackSword_L();
        }

        moveCtrl.isRunning = Keyboard.current.leftShiftKey.isPressed;
    }
Example #2
0
        private void Update()
        {
            if (Cooldown.Active)
            {
                return;
            }

            // Combat
            if (!Guarding && !AnimatorController.Attacking)
            {
                if (Input.GetMouseButton(0))
                {
                    AnimatorController.Charge(_attackChargeTime);
                    _attackChargeTime += Time.deltaTime;
                    AnimatorController.SetAttackDirection(-1);
                }

                if (Input.GetMouseButton(1))
                {
                    AnimatorController.Charge(_attackChargeTime);
                    _attackChargeTime += Time.deltaTime;
                    AnimatorController.SetAttackDirection(1);
                }

                if (Input.GetMouseButtonUp(0))
                {
                    if (TryParry())
                    {
                        return;
                    }

                    AnimatorController.Attack(EAttackDirection.Left, _attackChargeTime);
                    _attackChargeTime = 0;
                    AnimatorController.Charge(0);
                    return;
                }

                if (Input.GetMouseButtonUp(1))
                {
                    if (TryParry())
                    {
                        return;
                    }

                    AnimatorController.Attack(EAttackDirection.Right, _attackChargeTime);
                    _attackChargeTime = 0;
                    AnimatorController.Charge(0);
                    return;
                }
            }

            if (Input.GetMouseButton(0) || Input.GetMouseButton(1))
            {
                return;
            }

            // Movement
            if (!AnimatorController.Attacking && FeetCollider.Collided)
            {
                UpdateMovement();
                UpdateJump();
            }
        }
Example #3
0
 public void Play(Character target, System.Action finished, System.Action activated)
 {
     AnimationController.Attack(owner.ownerGO, owner, target, finished, activated);
 }