本文整理匯總了C#中Terraria.Player.AmountInInventory方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.AmountInInventory方法的具體用法?C# Player.AmountInInventory怎麽用?C# Player.AmountInInventory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Terraria.Player
的用法示例。
在下文中一共展示了Player.AmountInInventory方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CheckHitTile
public static void CheckHitTile(Player player)
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 437)
{
int i = Player.tileTargetX;
int j = Player.tileTargetY;
if (player.InventoryContains(1727) && player.AmountInInventory(1727) >= 76)
{
if (BuildWickerman(i + 1, j))
{
int amountNeeded = 76;
for (int k = 0; k < 58; k++)
{
if (player.inventory[k].type == 1727 && player.inventory[k].stack > 0)
{
player.inventory[k].stack -= amountNeeded;
if (player.inventory[k].stack < 0)
{
amountNeeded = 0 - player.inventory[k].stack;
}
}
}
}
else
{
Main.NewText("There are blocks obstructing the stencil.", Main.errorColor);
}
}
else
{
Main.NewText("Not enough hay to build structure.", Main.errorColor);
Main.NewText("Required: 76 You have: " + player.AmountInInventory(1727), Main.errorColor);
}
}
}