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)を通じてメッセージをやり取りしなければならない」というルールに変えてみた。
これでひとつの名前空間内のメッセージの流れを同じクラス内で管理できるようになった気がする。
試行錯誤も大事だとは思うが、これがベストプラクティスだみたいなのも誰か示してほしい。
デザインパターンか。デザインパターンだよな。

- 作者: 結城浩
- 出版社/メーカー: ソフトバンククリエイティブ
- 発売日: 2004/06/19
- メディア: 大型本
- 購入: 51人 クリック: 762回
- この商品を含むブログ (397件) を見る
一応読んだんだけど、例が抽象的だったりあまりにシンプルすぎたりしてどう応用したらいいのかよくわからない…
カロリーメイトください。

- 出版社/メーカー: 大塚製薬
- メディア: 食品&飲料
- この商品を含むブログを見る
今日のunityroom
ChaseAI | 無料ゲーム投稿サイト unityroom - Unityのゲームをアップロードして公開しよう
www.youtube.com
楽しみ方が違う。
この経路検索はアルゴリズムでやってんのかな?
勉強した気がするけど忘れた。