// Start is called before the first frame update
    private void Awake()
    {
        gameMaster  = FindObjectOfType <GameMaster>();
        audioSource = gameObject.AddComponent <AudioSource>();
        audioSource.outputAudioMixerGroup = amgSE;

        if (gameMaster == null) //デバッグ用(シーン直実行)
        {
            gameObject.AddComponent <RankingManager>();
            gameMaster = gameObject.AddComponent <GameMaster>();
            if (SceneManager.GetActiveScene().name != "Training")
            {
                gameMaster.gameMode = new GameMode(-1, "テスト", 3, true, true, testTrapezeLengs, -1f, "");
            }
            else
            {
                gameMaster.gameMode = gameMaster.gmTraining;
            }
            gameMaster.settings   = new Settings("加藤純一", true, 1f, true, 0, Application.version, 100000f);
            gameMaster.am         = am;
            gameMaster.isTutorial = isDebugTutorial;
        }
        if (gameMaster.gameMode.id == 99)
        {
            isTraining = true;
        }
        isTutorial = gameMaster.isTutorial;
        if (isTutorial)
        {
            GetComponent <Tutorial>().enabled = true;
        }
        //コメントテキストデータロード
        allComments = new List <CommentsData>();
        allComments.Add(Resources.Load <CommentsData>("Comments/CommentsData0"));
        allComments.Add(Resources.Load <CommentsData>("Comments/CommentsData1"));
        allComments.Add(Resources.Load <CommentsData>("Comments/CommentsData2"));
        allComments.Add(Resources.Load <CommentsData>("Comments/CommentsData3"));
        allComments.Add(Resources.Load <CommentsData>("Comments/CommentsData4"));

        playingManager = this;

        Stat       = Stat_global.init;
        _oldStat   = Stat;
        _oldPcStat = playerController.stat;
    }
    // Update is called once per frame
    void Update()
    {
        if (Stat == Stat_global.init)//開始時演出
        {
        }
        if (Stat == Stat_global.play || Stat == Stat_global.jump || Stat == Stat_global.fly)
        {
            elapseTime += Time.deltaTime; //経過時間計測用
        }
        if (!isReachElapseTime)
        {
            if (gameMaster.gameMode.timeLimit > 0 && elapseTime >= gameMaster.gameMode.timeLimit) //制限時間に到達
            {
                playerController.JUMP_on = true;
                var sld_JUMP = ugController.GetComponentInChildren <Slider>();
                sld_JUMP.value     = 1f;
                ugController.alpha = 0f;
            }
        }
        if (Stat != _oldStat)
        {
            switch (Stat)
            {
            case Stat_global.play:     //ジャンプまでの状態(漕ぐ+ジャンプ待機)
                break;

            case Stat_global.jump:     //ジャンプ実行時
                StartCoroutine(CutInProc());

                break;

            case Stat_global.fly:     //ジャンプ後(飛行中)
                StartCoroutine(Fadein(ugForAfterJump));
                StartCoroutine(Fadeout(ugForPlay));
                if (!isTraining)
                {
                    StartCoroutine(CameraRectChangeRight(cmrPlayerView, 1f));
                    cmrPlayerView.transform.parent = rb_Player.transform;
                }
                StartCoroutine(CameraRectChangeRight(cmrUI, 1f));
                StartCoroutine(CameraRectChangeRight(cmrPublic, 1f));
                StartCoroutine(CameraRectChangeLeft(cmrPlayer, 0f));
                StartCoroutine(CameraRectChangeLeft(cmrUiPlayer, 0f));
                if (!isTutorial)
                {
                    uiDistance.StartMessDistance();
                }
                if (isTraining)
                {
                    cmrPublic.GetComponent <PublicCameraPerspective>().stat = PublicCameraPerspective.stat_publicCamera.jump;
                }
                else
                {
                    cmrPublic.GetComponent <PublicCamera>().stat = PublicCamera.stat_publicCamera.jump;
                }
                txtVelocity.MassPoint = rb_Player;

                break;

            case Stat_global.result:     //リザルト画面

                break;

            default:
                break;
            }
        }
        if (playerController.stat != _oldPcStat && playerController.stat == PlayerController.stat_enum.finish) //リザルト確定条件
        {
            resultDistance = playerController.transform.position.z;
            Result(resultDistance, elapseTime);
            StartCoroutine(ShowResultUI());

            Stat = Stat_global.result;
        }
        _oldStat   = Stat;
        _oldPcStat = playerController.stat;
    }