本文整理汇总了C#中PlayerMovement.bankManifest方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerMovement.bankManifest方法的具体用法?C# PlayerMovement.bankManifest怎么用?C# PlayerMovement.bankManifest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerMovement
的用法示例。
在下文中一共展示了PlayerMovement.bankManifest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: storePlayerLoot
// Takes all of a player's loot and puts it into the bank, does not clear the player's inventory
private void storePlayerLoot(PlayerMovement player)
{
// Get all the players loot
string[] playerManifest = player.bankManifest();
// Loop through all of the players loot and put it in the bank
foreach(string lootItem in playerManifest)
{// Make sure that the loot listed is not null
if(lootItem != null)
{
int currVal = 0;
if(bank.TryGetValue(lootItem, out currVal))
{
bank[lootItem] = currVal + 1;
}// This else statement is in here because I know we will mess up on adding loot (forget to put it in lootname list
// or game object list)
else
{
// If the item was not in the bank from initialization already, something went very wrong
Debug.Log("Item " + lootItem + " was not in the set of known loot");
}
}
}
// Build the text that will tell the user what kinds of loot they have
StringBuilder lootText = new StringBuilder();
foreach(string lootItem in bank.Keys)
{
// Loot name
lootText.Append(lootItem);
// : to signify how many you have
lootText.Append(" : ");
// How many are in the bank right now
lootText.Append(bank[lootItem]);
// New line so next text will appear in organized fasion
lootText.Append("\n");
}
// After building the text we display it on the screen
bankText.text = lootText.ToString();
}