Esempio n. 1
0
    /// <summary>
    /// Checks inputs and executes related actions
    /// </summary>
    protected virtual void Actions()
    {
        // Actions verifications
        if (currentAttack != PlayerAttacks.None)
        {
            return;
        }

        controller.Jump("Jump", true);

        if (Input.GetButtonDown("Fire1"))
        {
            if (isGrounded)
            {
                AttackOne();
            }
            else
            {
                AirAttack();
            }
        }
        else if (Input.GetButtonDown("Fire2"))
        {
            if (isGrounded)
            {
                AttackTwo();
            }
            else
            {
                RodeoAttack();
            }
        }
        else if (Input.GetButtonDown("Fire3"))
        {
            AttackThree();
        }
        else if (Input.GetButtonDown("Alt Fire2"))
        {
            InteractWithObjects();
        }
        else if (Input.GetButtonDown("Alt Fire1"))
        {
            Catch();
        }
        else
        {
            // Get the triggers pression
            float _triggers = Input.GetAxis("Joystick Triggers");

            if (_triggers > .5f || Input.GetButtonDown("Throw"))
            {
                ThrowObject();
            }
            else if (_triggers < -.5f || Input.GetButtonDown("Dodge"))
            {
                StartCoroutine(Dodge());
            }
        }
    }