Example #1
0
    /// <summary>
    /// 入力の初期化
    /// </summary>
    /// <param name="npadIdsLength">使用するIDの配列の長さ</param>
    static public void InputInit(int npadIdsLength)
    {
        //配列の要素確保
        prevButtons    = new long[npadIdsLength];
        currentButtons = new long[npadIdsLength];
        stickInfos     = new StickInfo[npadIdsLength];
        for (int i = 0; i < npadIdsLength; ++i)
        {
            stickInfos[i] = new StickInfo();
        }
#if UNITY_EDITOR
        xboxCurrentButtons = new bool[npadIdsLength, (int)XboxInput.None];
        xboxPrevButtons    = new bool[npadIdsLength, (int)XboxInput.None];
#endif
    }
Example #2
0
    public static StickInfo GamePadStick(float hori, float vert)
    {
        StickInfo _inputStick;
        Vector3   _movePosition = new Vector3(hori, 0, -vert);

        if (hori != 0 || vert != 0)
        {
            inputVector.Set(hori, vert);
            inputVector.Normalize();
            rotateVector = InputAxisEulerAngle(inputVector);

            _inputStick = new StickInfo(hori, vert, inputVector.magnitude, _movePosition, rotateVector);
            return(_inputStick);
        }

        else
        {
            return(new StickInfo());
        }
    }