Exemplo n.º 1
0
        // FixedUpdate
        void FixedUpdate()
        {
            if (axesInputType == AxesInputType.BindAxes && !binded)
            {
                TCKInput.BindAxes("Joystick", BindPlayerAxes);
                binded = true;
                return;
            }

            if (axesInputType != AxesInputType.BindAxes && binded)
            {
                TCKInput.UnBindAxes("Joystick", BindPlayerAxes);
                binded = false;
                return;
            }


            if (axesInputType != AxesInputType.GetAxis)
            {
                return;
            }

            if (axesGetType == GetAxesMethod.GetByName)
            {
                float moveX = TCKInput.GetAxis("Joystick", "Horizontal");
                float moveY = TCKInput.GetAxis("Joystick", "Vertical");
                PlayerMovement(moveX, moveY);
            }
            else
            {
                float moveX = TCKInput.GetAxis("Joystick", AxisType.X);
                float moveY = TCKInput.GetAxis("Joystick", AxisType.Y);
                PlayerMovement(moveX, moveY);
            }
        }