-
-
Save todorok1/15b1a01ac268e63454445a7c03e7e50f to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第109回 タイトル画面の動作を管理するクラス
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| namespace SimpleRpg | |
| { | |
| /// <summary> | |
| /// タイトル画面の動作を管理するクラスです。 | |
| /// </summary> | |
| public class TitleManager : MonoBehaviour, IFadeCallback | |
| { | |
| /// <summary> | |
| /// タイトル画面のメニューを管理するクラスへの参照です。 | |
| /// </summary> | |
| [SerializeField] | |
| TitleMenuManager _titleMenuManager; | |
| /// <summary> | |
| /// リソースのロードを待つ時間です。 | |
| /// </summary> | |
| [SerializeField] | |
| float _resourceLoadWaitTime = 0.5f; | |
| void Start() | |
| { | |
| ResourceLoader.LoadDefinitionData(); | |
| StartCoroutine(StartProcess()); | |
| } | |
| /// <summary> | |
| /// ゲーム起動時の処理です。 | |
| /// </summary> | |
| IEnumerator StartProcess() | |
| { | |
| yield return StartCoroutine(WaitLoadResources()); | |
| // 画面をフェードインさせます。 | |
| FadeManager.Instance.SetCallback(this); | |
| FadeManager.Instance.FadeInScreen(); | |
| } | |
| /// <summary> | |
| /// リソースのロードを待ちます。 | |
| /// </summary> | |
| IEnumerator WaitLoadResources() | |
| { | |
| yield return new WaitForSeconds(_resourceLoadWaitTime); | |
| } | |
| /// <summary> | |
| /// フェードが完了したことを通知するコールバックです。 | |
| /// </summary> | |
| public void OnFinishedFade() | |
| { | |
| // タイトルメニューを操作できるようにします。 | |
| GameStartInfoHolder.isThroughInitScene = true; | |
| FadeManager.Instance.SetCallback(null); | |
| _titleMenuManager.StartSelect(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment