Beispiel #1
0
    /// <summary>
    /// ハイスコアの登録処理を行い、タイトルへ戻るコルーチン
    ///
    /// </summary>
    /// <param name="score">今回の走行距離</param>
    /// <returns></returns>
    IEnumerator ReturnToTitle(int score)
    {
        //ハイスコアを更新
        if (PlayerPrefs.GetInt("HighScore") < score)
        {
            PlayerPrefs.SetInt("HighScore", score);

            //「ハイスコア更新!」の文字列を表示
            UpdateInfoLabel.enabled = true;

            //走行記録をDBへ書き込み
            yield return(StartCoroutine(ConnectManager.RegistMileage()));

            //正常に書き込み出来ていたらゲーム画面に通知を表示
            if (!ConnectManager.IsError)
            {
                RegistInfoLabel.enabled = true;
            }
        }

        //3秒待機
        yield return(new WaitForSeconds(3.0f));

        //タイトルシーンに戻る
        SceneManager.LoadScene("Title");
    }