/// <summary>どの方向にコントローラーを振ったかの判定</summary>
    /// <param name="handNum">コントローラーの左右 0=左 1=右</param>
    void SwingCheck(int handNum)
    {
        if (roboCon == null)
        {
            return;
        }
        if (handNum == 0)
        {
            //左コントローラーの加速度を取得
            nowAcceleration[handNum] = GetInput.AccelerationGet(Hand.Left);
            //コントローラーの持つ向きが逆なのでZ軸を反転
            nowAcceleration[handNum].z *= -1;
        }

        if (handNum == 1)
        {
            //右コントローラーの加速度を取得
            nowAcceleration[handNum] = GetInput.AccelerationGet(Hand.Right);
        }
        /*この先、各コントローラーごとに判定を作成*/

        //delayFlagがfalseの時、実行
        if (!delayFlag[handNum])
        {
            //samplingFlagがfalseの時、取得した加速度のY又はZが一定値以上の時、samplingFlagをtrueにしサンプリング開始
            if (!samplingFlag[handNum])
            {
                samplingFlag[handNum] =
                    Mathf.Abs(nowAcceleration[handNum].z) >= m_controlValue_z[handNum] ||
                    Mathf.Abs(nowAcceleration[handNum].y) >= m_controlValue_y[handNum];
            }
            //samplingFlagがtrueの時、実行
            if (samplingFlag[handNum])
            {   //加速度をaccelerationKeep配列に格納し、index用のlistCount[handNum]をインクリメント
                accelerationKeep[handNum, listCount[handNum]++] = nowAcceleration[handNum];

                /*ログ用*****************************************************************************
                 * txt1.text = "OriginLeft\n" +
                 *        accelerationKeep[0, 0] + "\n" + accelerationKeep[0, 1] + "\n" + accelerationKeep[0, 2] + "\n" + accelerationKeep[0, 3] + "\n" + accelerationKeep[0, 4] + "\n" +
                 *    "\nOriginRight\n" +
                 *        accelerationKeep[1, 0] + "\n" + accelerationKeep[1, 1] + "\n" + accelerationKeep[1, 2] + "\n" + accelerationKeep[1, 3] + "\n" + accelerationKeep[1, 4];
                 * //*****************************************************************************/
                //配列が全て埋まった時、実行
                if (listCount[handNum] >= listSize)
                {
                    for (int i = 0; i < listSize; i++)
                    {
                        //格納した加速度のZ軸がマイナスの時、二次元配列mix[handNum, (int)Line.Left]に加算
                        if (accelerationKeep[handNum, i].z <= 0)
                        {
                            mix[handNum, (int)Line.Left] += accelerationKeep[handNum, i].z;
                        }
                        //格納した加速度のZ軸がプラスの時、二次元配列mix[handNum, (int)Line.Right]に加算
                        if (accelerationKeep[handNum, i].z >= 0)
                        {
                            mix[handNum, (int)Line.Right] += accelerationKeep[handNum, i].z;
                        }
                        //格納した加速度のY軸の絶対値が一定以上の時、二次元配列mix[handNum, (int)Line.Center]に加算
                        if (Mathf.Abs(accelerationKeep[handNum, i].y) >= m_controlValue_y[handNum])
                        {
                            mix[handNum, (int)Line.Center] += accelerationKeep[handNum, i].y;
                        }

                        /*ログ用*****************************************************************************
                         * Sample[handNum, i] = new Vector3(mix[handNum, (int)Line.Left], mix[handNum, (int)Line.Center], mix[handNum, (int)Line.Right]);
                         * txt2.text = "SampleLeft\n" +
                         * Sample[0, 0] + "\n" + Sample[0, 1] + "\n" + Sample[0, 2] + "\n" + Sample[0, 3] + "\n" + Sample[0, 4] +
                         * "\nSampleRight\n" +
                         * Sample[1, 0] + "\n" + Sample[1, 1] + "\n" + Sample[1, 2] + "\n" + Sample[1, 3] + "\n" + Sample[1, 4];
                         * //*****************************************************************************/
                    }
                    //Z軸の値補正用の関数(現在使用してない)
                    Support(handNum, mix);
                    //sideに【mix[handNum, (int)Line.Left]】と【mix[handNum, (int)Line.Right]】の大きい方を代入
                    side[handNum] =
                        Mathf.Abs(mix[handNum, (int)Line.Left]) > Mathf.Abs(mix[handNum, (int)Line.Right]) ?
                        mix[handNum, (int)Line.Left] : mix[handNum, (int)Line.Right];
                    //accelerationKeep配列の中を初期化
                    for (int i = 0; i < listSize; i++)
                    {
                        accelerationKeep[handNum, i] = Vector3.zero;
                    }
                    //index用のlistCount[handNum]を0に
                    listCount[handNum] = 0;
                    //サンプリング終了なのでsamplingFlagをfalseに
                    samplingFlag[handNum] = false;
                    //サンプリング終了時に振った方向を調べるためcheck[handNum]をtrueに
                    check[handNum] = true;
                }
            }
            //サンプリング終了時に実行
            if (check[handNum])
            {
                //加算された加速度のY軸とZ軸の絶対値を比べる
                if (Mathf.Abs(side[handNum]) > Mathf.Abs(mix[handNum, (int)Line.Center]) || mode == 0)
                {
                    //Z軸の絶対値の方が大きいとき

                    //Z軸がプラスの時
                    if (side[handNum] >= 0)
                    {
                        //右レーンに対しAttack
                        if (mode == 1)
                        {
                            roboCon.Attack(handNum, RobotControl.Lane.Right);
                            StartCoroutine(DelayTime(handNum, RobotControl.Lane.Right));
                        }
                        else if (mode == 0)
                        {
                            setUp.TutorialSelected(handNum, false);
                        }
                    }
                    else//Z軸がマイナスの時
                    {   //左レーンに対しAttack
                        if (mode == 1)
                        {
                            roboCon.Attack(handNum, RobotControl.Lane.Left);
                            StartCoroutine(DelayTime(handNum, RobotControl.Lane.Left));
                        }
                        else if (mode == 0)
                        {
                            setUp.TutorialSelected(handNum, true);
                        }
                    }
                }
                else
                {
                    //Y軸の方が大きいとき

                    //Z軸の絶対値が6より大きい時、Z軸判定を行う
                    if (Mathf.Abs(side[handNum]) > 6f)
                    {
                        //Z軸がプラスの時
                        if (side[handNum] >= 0)
                        {
                            //右レーンに対しAttack
                            if (mode == 1)
                            {
                                roboCon.Attack(handNum, RobotControl.Lane.Right);
                                StartCoroutine(DelayTime(handNum, RobotControl.Lane.Right));
                            }
                            else if (mode == 0)
                            {
                                check[handNum] = false;
                                setUp.TutorialSelected(handNum, false);
                            }
                        }
                        else//Z軸がマイナスの時
                        {   //左レーンに対しAttack
                            if (mode == 1)
                            {
                                roboCon.Attack(handNum, RobotControl.Lane.Left);
                                StartCoroutine(DelayTime(handNum, RobotControl.Lane.Left));
                            }
                            else if (mode == 0)
                            {
                                check[handNum] = false;
                                setUp.TutorialSelected(handNum, true);
                            }
                        }
                    }
                    else
                    {
                        //中央レーンに対しAttack
                        if (mode != 1)
                        {
                            return;
                        }
                        roboCon.Attack(handNum, RobotControl.Lane.Center);
                        StartCoroutine(DelayTime(handNum, RobotControl.Lane.Center));
                    }
                }
                //判定終了なのでcheck[handNum]をfalseに
                check[handNum] = false;
            }
        }
    }
    void Attack()
    {
        const float l_controlValue_x = 4f;
        const float l_controlValue_y = 4f;


        Vector3 m_acceleration = new Vector3();

        oldAcceleration = nowAcceleration;
        Vector3 m_baseAcc = new Vector3(0, -1, 0);

        nowAcceleration = acc - m_baseAcc;
        txt.text        = "" + nowAcceleration;

        if (!samplingFlag)
        {
            samplingFlag = Mathf.Abs(nowAcceleration.z) >= l_controlValue_x || Mathf.Abs(nowAcceleration.y) >= l_controlValue_y;
        }
        else
        {
            AccelerationKeep[listCount] = nowAcceleration;
            listCount++;

            if (listCount >= AccelerationKeep.Length)
            {
                Vector3 Vec3 = Vector3.zero;

                for (int i = 0; i < listCount; i++)
                {
                    Vec3 += AccelerationKeep[i];
                }

                for (int i = 0; i < 10; i++)
                {
                    AccelerationKeep[i] = Vector3.zero;
                }

                m_acceleration = Vec3;
                listCount      = 0;
                samplingFlag   = false;
            }
        }
        if (Mathf.Abs(m_acceleration.y) >= l_controlValue_y &&
            Mathf.Abs(m_acceleration.z) < l_controlValue_x)
        {
            if (max[1] < Mathf.Abs(m_acceleration.y))
            {
                max[1] = Mathf.Abs(m_acceleration.y);
            }
            roboCon.Attack(0, RobotControl.Lane.Center);
        }
        if (Mathf.Abs(m_acceleration.z) >= l_controlValue_x)
        {
            if (m_acceleration.z >= 0)
            {
                if (max[2] < m_acceleration.z)
                {
                    max[2] = m_acceleration.z;
                }
                roboCon.Attack(0, RobotControl.Lane.Right);
            }
            else
            {
                if (max[0] > m_acceleration.z)
                {
                    max[0] = m_acceleration.z;
                }
                roboCon.Attack(0, RobotControl.Lane.Left);
            }
        }
    }