Created
September 7, 2016 15:41
-
-
Save Krita3/46eb0a9703c7878d1384978d20c26d13 to your computer and use it in GitHub Desktop.
Compositeパターン アイテムディレクトリを表すクラス
This file contains 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.Generic; | |
public class GameItemDirectory : Entry | |
{ | |
// 要素のリスト | |
private List<Entry> directory = new List<Entry>(); | |
// コンストラクタ | |
public GameItemDirectory(string name) | |
{ | |
this.name = name; | |
} | |
// このディレクトリに新しい要素を追加 | |
public Entry Add(Entry entry) | |
{ | |
this.directory.Add(entry); | |
return this; | |
} | |
public override void PrintListLog(string prefix) | |
{ | |
Debug.Log(prefix + "/" + this); | |
foreach (var element in this.directory) | |
{ | |
Entry entry = (Entry)element; | |
entry.PrintListLog(prefix + "/" + this); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment