Ejemplo n.º 1
0
    private void InitInputs()
    {
        PlayerInput.Gameplay.Move.performed += context => playerController.moveDirection = context.ReadValue <Vector2>();
        PlayerInput.Gameplay.Move.canceled  += context => playerController.moveDirection = context.ReadValue <Vector2>();

        PlayerInput.Gameplay.MousePosition.performed += context => playerController.mousePosition = context.ReadValue <Vector2>();
        PlayerInput.Gameplay.MousePosition.canceled  += context => playerController.mousePosition = context.ReadValue <Vector2>();

        PlayerInput.Gameplay.Attack.started   += context => playerCombat.StartAttackCmd();
        PlayerInput.Gameplay.Attack.performed += context => playerCombat.PerformAttackCmd();
        PlayerInput.Gameplay.Attack.canceled  += context => playerCombat.CancelAttackCmd();

#if UNITY_EDITOR
        PlayerInput.Gameplay.Block.performed += context => playerCombat.BlockCmd(true);
        PlayerInput.Gameplay.Block.canceled  += context => playerCombat.BlockCmd(false);

        // PlayerInput.Gameplay.Block.performed += context => playerCombat.BlockCmd(block = !block);
#else
        PlayerInput.Gameplay.Block.performed += context => playerCombat.BlockCmd(true);
        PlayerInput.Gameplay.Block.canceled  += context => playerCombat.BlockCmd(false);
#endif
    }