本文整理汇总了C#中Inventory.Size方法的典型用法代码示例。如果您正苦于以下问题:C# Inventory.Size方法的具体用法?C# Inventory.Size怎么用?C# Inventory.Size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory.Size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public void Use(GameObject _player)
{
if ((++countZ & 1) == 0 || destroyed)
return;
if (locked)
{
plyinv = _player.GetComponent<Inventory>();
if (plyinv)
{
for (int i = 0; i < plyinv.Size(); i++)
{
if (plyinv.items[i] != null)
{
for (int k = 0; k < items2.Length; k++)
{
if (plyinv.items[i].name == items2[k].name)
{
if (Destructable)
{
//DestroyObject(gameObject);
if (plyinv.items[i].name != "sledge" || plyinv.items[i].name != "staff")
{
plyinv.items[i] = null;
}
if(!audio.isPlaying)
audio.PlayOneShot (breakdownclip);
gameObject.transform.localRotation = Quaternion.Euler(x, y, z);
destroyed = true;
return;
}
}
}
if (plyinv.items[i].name == ItemName)
{
locked = false;
break;
}
}
}
if(!audio.isPlaying)
audio.PlayOneShot (lockedclip);
}
}
if (!locked)
{
if (!test)
{
Debug.Log("log1:" + test);
gameObject.transform.localRotation = new Quaternion(0, 45, 0, 0);
if(!audio.isPlaying)
audio.PlayOneShot (unlockclip);
test = true;
Debug.Log("log2:" + test);
}
else
{
Debug.Log("This is happening and it should not be.");
if (!doubledoor)
gameObject.transform.localRotation = Quaternion.Euler(0, 90, 0);
else
gameObject.transform.localRotation = Quaternion.Euler(0, 270, 0);
if(!audio.isPlaying)
audio.PlayOneShot (closeclip);
test = false;
}
}
}