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


C# Inventory.GetComponent方法代码示例

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

示例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;

	}
开发者ID:fsanta328,项目名称:Garden-of-Eden,代码行数:13,代码来源:ItemData.cs

示例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;
        }
    }
开发者ID:LadyRhapsody,项目名称:MyWorld,代码行数:23,代码来源:Fridge.cs

示例4: Start

 void Start()
 {
     inv = GameObject.Find("Inventory").GetComponent<Inventory>();
     tooltip = inv.GetComponent<ToolTip>();
 }
开发者ID:williamburgstaler1989,项目名称:SpiritHounds,代码行数:5,代码来源:ItemData.cs

示例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>();
 }
开发者ID:CarsonRoscoe,项目名称:DefendAman,代码行数:17,代码来源:ItemData.cs

示例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);
 }
开发者ID:romgerman,项目名称:Oxide,代码行数:8,代码来源:HooksTest.cs

示例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>();
 }
开发者ID:dhurst22,项目名称:_80sActionHero,代码行数:7,代码来源:ItemData.cs

示例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;
 }
开发者ID:TheOneAndOnlyLoki,项目名称:RustEssentials,代码行数:83,代码来源:Vars.cs

示例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>();
 }
开发者ID:CarsonRoscoe,项目名称:DefendAman,代码行数:7,代码来源:PotionTooltip5.cs

示例10: Start

 void Start()
 {
     _inv = GameObject.FindGameObjectWithTag(TagList.Inventory).GetComponent<Inventory>();
     _tooltip = _inv.GetComponent<Tooltip>();
 }
开发者ID:BeauArthurs,项目名称:KingdomOfMadness,代码行数:5,代码来源:ItemData.cs


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