Exemple #1
0
    private void PlayerControl()
    {
        if (!ControlBlocked)
        {
            horizontalInput = Mathf.FloorToInt(Input.GetAxis("Horizontal"));
            verticalInput   = Mathf.FloorToInt(Input.GetAxis("Vertical"));

            if (horizontalInput != 0)
            {
                player.OnHorizontalInput(horizontalInput);
            }
            else
            {
                player.OnHorizontalInputUp();
            }

            if (verticalInput != 0f)
            {
                player.OnVerticalInput(verticalInput);
            }
            else
            {
                player.OnVerticalInputUp();
            }

            if (Input.GetButtonDown("Jump"))
            {
                //if (!playerInteract.CheckInteraction())
                //{
                //    player.OnJumpInputDown();
                //}

                player.OnJumpInputDown();
            }
            else if (Input.GetButtonDown("Dodge"))
            {
                player.OnDodgeInputDown();
            }
            else if (Input.GetButtonDown("Melee Attack"))
            {
                player.OnMeleeAttackInputDown();
            }
            else if (Input.GetButtonDown("Skill 1"))
            {
                player.OnSkillInputDown(0);
            }
            else if (Input.GetButtonDown("Skill 2"))
            {
                player.OnSkillInputDown(1);
            }

            // CHECK INTERACTIONS
            if (Input.GetButtonDown("Interact"))
            {
                playerInteract.CheckInteraction();
            }

            if (Input.GetButtonDown("Inventory"))
            {
                OpenEquipement();
            }
        }
    }