本文整理汇总了C#中Inventory.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# Inventory.GetComponent方法的具体用法?C# Inventory.GetComponent怎么用?C# Inventory.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory.GetComponent方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start () {
inv = GameObject.FindGameObjectWithTag("Player").GetComponent<Inventory>();
playerAttack = inv.GetComponent<PlayerAttacking>();
rectTransform = (RectTransform)transform;
setPosition(cIndex);
}
示例2: Start
// Use this for initialization
void Start ()
{
m_inventory = GameObject.Find ("Inventory").GetComponent<Inventory> ();
//m_amount = 1;
m_toolTip = m_inventory.GetComponent<ToolTip> ();
m_playerObj = GameObject.Find ("Berserker");
m_player = m_playerObj.GetComponent<Player> ();
m_attack = m_player.GetComponent<Player> ().m_attack;
m_defence = m_player.GetComponent<Player> ().m_defence;
m_health = m_player.GetComponent<Player> ().m_health;
}
示例3: showInventory
private void showInventory()
{
var pm = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerMovement>();
pm.StopWalk();
if (acutalInventory == null)
{
parent = GameObject.FindGameObjectWithTag("HUB").transform;
acutalInventory = Instantiate(inventory) as Inventory;
//new Vector3(-40,-170)
acutalInventory.transform.SetParent(parent);
RectTransform rect = acutalInventory.GetComponent<RectTransform>();
acutalInventory.StartInventory("Barinventory");
rect.localPosition = new Vector3(-270, 0);
}
else
{
acutalInventory.enabled = true;
}
}
示例4: Start
void Start()
{
inv = GameObject.Find("Inventory").GetComponent<Inventory>();
tooltip = inv.GetComponent<ToolTip>();
}
示例5: Start
/*---------------------------------------------------------------------------------------
-- FUNCTION: Start
-- DATE: 17/02/2016
-- REVISIONS:
-- DESIGNER: Joseph Tam-Huang
-- PROGRAMMER: Joseph Tam-Huang
-- INTERFACE: void Start()
-- RETURNS: void
-- NOTES:
-- Retrieves the Inventory script, the Tooltip script and the ItemMenu script.
----------------------------------------------------------------------------------------*/
void Start()
{
_inventory = GameObject.Find("Inventory").GetComponent<Inventory>();
_tooltip = _inventory.GetComponent<Tooltip>();
_item_menu = _inventory.GetComponent<ItemMenu>();
}
示例6: OnItemRemoved
private void OnItemRemoved(Inventory inventory, int slot, IInventoryItem item)
{
HookCalled("OnItemRemoved");
// Print item removed
var netUser = inventory.GetComponent<Character>()?.netUser;
if (netUser == null) return;
Puts(item.datablock.name + " was removed from inventory slot " + slot.ToString() + " owned by " + netUser.displayName);
}
示例7: Start
void Start()
{
inv = GameObject.Find("Inventory").GetComponent<Inventory>();
hero = GameObject.Find("Hero").GetComponent<HeroHealthManager>();
//characterPanel = GameObject.Find("Character Panel").GetComponent<CharacterPanel>();
tooltip = inv.GetComponent<ToolTip>();
}
示例8: CanCraft
public static bool CanCraft(int amount, Inventory workbenchInv, BlueprintDataBlock BDB)
{
if (BDB.lastCanWorkResult == null)
{
BDB.lastCanWorkResult = new List<int>();
}
else
{
BDB.lastCanWorkResult.Clear();
}
if (BDB.lastCanWorkIngredientCount == null)
{
BDB.lastCanWorkIngredientCount = new List<int>(BDB.ingredients.Length);
}
else
{
BDB.lastCanWorkIngredientCount.Clear();
}
PlayerClient playerClient = Array.Find(AllPlayerClients.ToArray(), (PlayerClient pc) => pc.netPlayer == workbenchInv.networkView.owner);
if (playerClient != null)
{
if (!craftList.Contains(playerClient.userID.ToString()))
{
if (BDB.RequireWorkbench && craftAtBench)
{
CraftingInventory component = workbenchInv.GetComponent<CraftingInventory>();
if ((component == null) || !component.AtWorkBench())
{
return false;
}
}
}
}
else
{
if (BDB.RequireWorkbench && craftAtBench)
{
CraftingInventory component = workbenchInv.GetComponent<CraftingInventory>();
if ((component == null) || !component.AtWorkBench())
{
return false;
}
}
}
if (playerClient != null)
{
if (!craftList.Contains(playerClient.userID.ToString()))
{
foreach (BlueprintDataBlock.IngredientEntry entry in BDB.ingredients)
{
if (entry.amount != 0)
{
int item = workbenchInv.CanConsume(entry.Ingredient, entry.amount * amount, BDB.lastCanWorkResult);
if (item <= 0)
{
BDB.lastCanWorkResult.Clear();
BDB.lastCanWorkIngredientCount.Clear();
return false;
}
BDB.lastCanWorkIngredientCount.Add(item);
}
}
}
}
else
{
foreach (BlueprintDataBlock.IngredientEntry entry in BDB.ingredients)
{
if (entry.amount != 0)
{
int item = workbenchInv.CanConsume(entry.Ingredient, entry.amount * amount, BDB.lastCanWorkResult);
if (item <= 0)
{
BDB.lastCanWorkResult.Clear();
BDB.lastCanWorkIngredientCount.Clear();
return false;
}
BDB.lastCanWorkIngredientCount.Add(item);
}
}
}
return true;
}
示例9: Start
// Use this for initialization
void Start()
{
_inventory = GameObject.Find("Inventory").GetComponent<Inventory>();
_tooltip = _inventory.GetComponent<Tooltip>();
_item_manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<ItemManager>();
}
示例10: Start
void Start()
{
_inv = GameObject.FindGameObjectWithTag(TagList.Inventory).GetComponent<Inventory>();
_tooltip = _inv.GetComponent<Tooltip>();
}