当前位置: 首页>>代码示例>>C#>>正文


C# PlayerMovement.bankManifest方法代码示例

本文整理汇总了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();
 }
开发者ID:Choga,项目名称:SpaceShooterGame,代码行数:39,代码来源:HubWorld.cs


注:本文中的PlayerMovement.bankManifest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。