Пример #1
0
    // Update is called once per frame
    public new void UnpauseUpdate()
    {
        target.cam = cam;
        //if (//!GameManager.instance ||
        //!GameManager.instance.playerControlLocked)
        {
            connected = true;

            if (cameraRelative)
            {
                Vector3 _screenForward = _screenMovementSpace * Vector3.forward;
                Vector3 _screenRight   = _screenMovementSpace * Vector3.right;

                _screenMovementSpace = Quaternion.Euler(0f, cam.transform.eulerAngles.y, 0f);                  // yaw only

                Vector3 movementRight   = (inputMod.GetAxis(m_input.horizontalAxis)) * _screenRight;
                Vector3 movementForward = (inputMod.GetAxis(m_input.verticalAxis)) * _screenForward;

                Vector3 overallCalculation = (movementRight + movementForward);

                target.axes = new Vector2(overallCalculation.x, overallCalculation.z);
            }
            else
            {
                target.axes = new Vector2(inputMod.GetAxis(m_input.horizontalAxis), inputMod.GetAxis(m_input.verticalAxis));
            }



            //print ("Right " + movementRight);
            //print ("Forward " + movementForward);

            if (target)
            {
                target.eventInteract = inputMod.GetButtonDown(m_input.actionButton);
                target.run           = inputMod.GetButton(m_input.runButton);
                target.jump          = inputMod.GetButton(m_input.jumpButton);
            }
        }

        /*
         * else {
         *      if (connected && !sustainInputsOnDisable) {
         *              target.axes = Vector2.zero;
         *              target.run = false;
         *              target.jump = false;
         *              target.eventInteract = false;
         *
         *      }
         *      connected = false;
         * }
         */

        //target.axes = new Vector2 (, );
    }
Пример #2
0
    // Update is called once per frame
    public new void Update()
    {
        if (menu.canInput)
        {
            foreach (menuButtons currentButton in m_menuButtons)
            {
                if (currentButton.usable)
                {
                    if (inputModule.GetButtonDown(currentButton.input))
                    {
                        currentButton.onButtonDown.Invoke();
                        //print ("Get " + currentButton.input + " down!");
                    }

                    if (inputModule.GetButtonUp(currentButton.input))
                    {
                        currentButton.onButtonUp.Invoke();
                    }

                    if (inputModule.GetNegativeButtonDown(currentButton.input))
                    {
                        currentButton.onNegativeButtonDown.Invoke();
                        //print ("Get " + currentButton.input + " down!");
                    }

                    if (inputModule.GetNegativeButtonUp(currentButton.input))
                    {
                        currentButton.onNegativeButtonUp.Invoke();
                    }
                }
                else if (inputModule.GetButtonDown(currentButton.input))
                {
                    currentButton.onButtonBlocked.Invoke();
                }
            }
        }

        //print("AxisGet " + inputModule.GetAxis ("Horizontal"));

        menu.inputAxes.x = inputModule.GetAxis("Horizontal");
        menu.inputAxes.y = inputModule.GetAxis("Vertical");

        menu.inputSubmit = inputModule.GetButtonDown("Menu Confirm");
        menu.inputCancel = inputModule.GetButtonDown("Menu Cancel");
    }