カロリーメイトください

Barbaroi Ware(バルバロイ・ウェア)という名前でアプリ開発してます

『Select10』(勝手に)模写する7

f:id:yjkym:20190103183938p:plain
select10 | 無料ゲーム投稿サイト unityroom - Unityのゲームをアップロードして公開しよう

序文

「Select10」模写7日目。

GitHubのプライベートリポジトリが無料で使えるようになったみたいですね。
これGitHubにあげて管理したいけど、(権利的に)このファイル公開したらマズいなぁ…みたいなことがよくあったのでありがたいです。

進捗

  • 設計見直し

コード実装部分(一部)

Select10Copy\Assets\Scripts\TitleFacade.cs

using BGM;
using System.Collections;
using UnityEngine;

namespace Title
{
    public class TitleFacade : MonoBehaviour
    {
        public TitleFacade titleFacade;

        public TitleLogoFader titleLogoFader;

        public GameObject title10Button;
        public Title10ButtonSound title10ButtonSound;
        public Title10ButtonAnimator title10ButtonAnimator;

        public GameObject titleArrow;
        public TitleArrowSound titleArrowSound;
        public TitleArrowAnimator titleArrowAnimator;

        public BGMPlayer bgmPlayer;

        public float animationTimeAfterWaitTime;
        public TitleCanvasFader titleCanvasFader;


        internal void DisplayTitle()
        {
            StartCoroutine(_DisplayTitle());
        }

        private IEnumerator _DisplayTitle()
        {
            float fadeInTime = 1.0f;
            titleLogoFader.FadeIn(fadeInTime);
            yield return new WaitForSeconds(fadeInTime);

            title10Button.SetActive(true);
            title10ButtonSound.SoundSEActivate();
            float button10AnimationTime = 1.0f;
            title10ButtonAnimator.AnimateActivate(button10AnimationTime);
            yield return new WaitForSeconds(button10AnimationTime);

            titleArrow.SetActive(true);
            titleArrowSound.SoundSE();
            float arrowAnimationTime = 0.5f;
            titleArrowAnimator.Animate(arrowAnimationTime);
            yield return new WaitForSeconds(arrowAnimationTime);
        }

        public void OnClickTitleButton()
        {
            StartCoroutine(_OnClickTitleButton());
        }

        private IEnumerator _OnClickTitleButton()
        {
            float animationTime = 1.0f;
            title10ButtonSound.SoundSEPushButton();
            title10ButtonAnimator.AnimatePushButton(animationTime);
            bgmPlayer.StopBGM();
            yield return new WaitForSeconds(animationTimeAfterWaitTime);

            float fadeOutTime = 1.0f;
            titleCanvasFader.FadeOut(fadeOutTime);
            yield return new WaitForSeconds(fadeOutTime);
        }
    }
}

実行結果

昨日と同じなので割愛

感想

今までは「同じ名前空間に属するクラスは直接メッセージをやり取りしてよい。異なる名前空間に属するクラスは専用のクラスを通じてメッセージをやり取りしなければならない」というルールで設計を行っていたのだけど、「同じ名前空間に属するクラスも専用のクラス(Facade)を通じてメッセージをやり取りしなければならない」というルールに変えてみた。
これでひとつの名前空間内のメッセージの流れを同じクラス内で管理できるようになった気がする。

試行錯誤も大事だとは思うが、これがベストプラクティスだみたいなのも誰か示してほしい。
デザインパターンか。デザインパターンだよな。

増補改訂版Java言語で学ぶデザインパターン入門

増補改訂版Java言語で学ぶデザインパターン入門

一応読んだんだけど、例が抽象的だったりあまりにシンプルすぎたりしてどう応用したらいいのかよくわからない…

カロリーメイトください。

今日のunityroom

ChaseAI | 無料ゲーム投稿サイト unityroom - Unityのゲームをアップロードして公開しよう www.youtube.com 楽しみ方が違う。
この経路検索はアルゴリズムでやってんのかな?
勉強した気がするけど忘れた。