Last active
June 19, 2017 01:38
-
-
Save dskjal/22bc749c33b784df6c1f26117fc3a952 to your computer and use it in GitHub Desktop.
アイテムデータベースの例
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
struct ItemData{ | |
int ItemID; | |
// その他のフィールド変数 | |
} | |
class ItemDB{ | |
private ItemData items[]; | |
public ItemData this[int i]{ | |
get{ | |
return items[i] | |
} | |
} | |
public void LoadFromFile(string filePath){} | |
} | |
// プレイヤーの手持ちのアイテム | |
struct Stock{ | |
int ItemID; | |
int Quantity; | |
} | |
// プレイヤーのインベントリを管理するクラス | |
class ActorInventory{ | |
List<Stock> items; | |
// Update が肥大化する | |
void Update(){ | |
usedItemID = playerUseItem(); | |
switch(usedItemID){ | |
case 0: // 回復薬 | |
break; | |
case 1: // 攻撃バフ | |
break; | |
// ... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment