public virtual void GetInput()
    {
        if (connectedController != null)
        {
            inputHorizontal = (Input.GetAxisRaw(connectedController.GetHorizontal()));
            inputVertical   = (Input.GetAxisRaw(connectedController.GetVertical()));

            trig_active = connectedController.Trig_CheckInput();
            a_active    = connectedController.A_CheckInput();
            b_active    = connectedController.B_CheckInput();
            x_active    = connectedController.X_CheckInput();
            y_active    = connectedController.Y_CheckInput();

            if (inputHorizontal != 0)
            {
                FlipSprite(connectedController.GetHorizontal());
            }
        }
        else
        {
            inputHorizontal = Input.GetAxis("Horizontal");
            inputVertical   = Input.GetAxis("Vertical");

            FlipSprite("Horizontal");
        }
    }
예제 #2
0
    private void Update()
    {
        // Check if player touches a ground object
        if (Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround))
        {
            grounded = true;
        }
        else
        {
            grounded = false;
        }

        trig_active = connectedController.Trig_CheckInput();
        a_active    = connectedController.A_CheckInput();
        b_active    = connectedController.B_CheckInput();
        x_active    = connectedController.X_CheckInput();
        y_active    = connectedController.Y_CheckInput();

        if (trig_active)
        {
            if (A_Animator.gameObject.activeSelf)
            {
                A_Animator.SetBool("leftTrigger", true);
            }
            if (B_Animator.gameObject.activeSelf)
            {
                B_Animator.SetBool("leftTrigger", true);
            }
            if (X_Animator.gameObject.activeSelf)
            {
                X_Animator.SetBool("leftTrigger", true);
            }
            if (Y_Animator.gameObject.activeSelf)
            {
                Y_Animator.SetBool("leftTrigger", true);
            }
            if (a_active && a_isEnabled)
            {
                Debug.Log(connectedController.GetControllerName() + "A Trigger!");
                A_SwapCall();
            }
            if (b_active && b_isEnabled)
            {
                Debug.Log(connectedController.GetControllerName() + "B Trigger!");
                B_SwapCall();
                Y_SwapCall();
            }
            if (x_active && x_isEnabled)
            {
                Debug.Log(connectedController.GetControllerName() + "X Trigger!");
                X_SwapCall();
            }
            if (y_active && y_isEnabled)
            {
                Debug.Log(connectedController.GetControllerName() + "Y Trigger!");
                Y_SwapCall();
                B_SwapCall();
            }
        }
        else
        {
            if (A_Animator.gameObject.activeSelf)
            {
                A_Animator.SetBool("leftTrigger", false);
            }
            if (B_Animator.gameObject.activeSelf)
            {
                B_Animator.SetBool("leftTrigger", false);
            }
            if (X_Animator.gameObject.activeSelf)
            {
                X_Animator.SetBool("leftTrigger", false);
            }
            if (Y_Animator.gameObject.activeSelf)
            {
                Y_Animator.SetBool("leftTrigger", false);
            }

            if (b_active && b_isEnabled)
            {
                Shrink();
                Debug.Log(connectedController.GetControllerName() + "B");
            }
            if (x_active && x_isEnabled && hasItem)
            {
                //Gets handled in OnTriggerStay()

                /*Debug.Log(x_active);
                 * Debug.Log(x_isEnabled);
                 * Debug.Log(hasItem);
                 * Debug.Break();*/
                DropItem();

                Debug.Log(connectedController.GetControllerName() + "X");
            }
            if (y_active && y_isEnabled)
            {
                Grow();
                Debug.Log(connectedController.GetControllerName() + "Y");
            }
        }
    }