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


C# InventoryItem.GenerateNewInventoryItem方法代码示例

本文整理汇总了C#中InventoryItem.GenerateNewInventoryItem方法的典型用法代码示例。如果您正苦于以下问题:C# InventoryItem.GenerateNewInventoryItem方法的具体用法?C# InventoryItem.GenerateNewInventoryItem怎么用?C# InventoryItem.GenerateNewInventoryItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InventoryItem的用法示例。


在下文中一共展示了InventoryItem.GenerateNewInventoryItem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

	// Use this for initialization
	void Start () {
		myPhotonView = GetComponent<PhotonView>();
		construction = Storage.LoadById<RPGConstruction>(ID, new RPGConstruction());
		constructedNPC = Storage.LoadById<RPGNPC>(NPCID, new RPGNPC());
		if(construction != null)
		{
			GameObject.FindGameObjectWithTag("WorldManager").GetComponent<WorldManager>().AddConstruction(construction);
		}
		for (int i = 0; i < construction.requiredItems.Count; i++) {
			if(construction.requiredItems[i].PreffixTarget == PreffixType.ITEM)
			{
				InventoryItem newInventoryItem = new InventoryItem();
				newInventoryItem.GenerateNewInventoryItem(Storage.LoadById<RPGItem>(construction.requiredItems[i].TaskTarget, new RPGItem()), construction.requiredItems[i].Tasklevel, construction.requiredItems[i].AmountToReach);
				requiredItems.Add(newInventoryItem);
				requiredItemsQuantity.Add(construction.requiredItems[i].AmountToReach);
            }
        }
		if(trigger)
		{
			triggerCollider = trigger.GetComponent<Collider>();
			trigger.transform.localScale = startScale;
		}
		dragDropCollider.enabled = false;
		if(!PhotonNetwork.isMasterClient)
			RequestConstructionUpdate();
	}
开发者ID:reaganq,项目名称:MagnetBots_unity,代码行数:27,代码来源:Construction.cs

示例2: LoadRequiredItems

	public void LoadRequiredItems()
	{
		for (int i = 0; i < requiredItems.Count; i++) {
			if(requiredItems[i].PreffixTarget == PreffixType.ITEM)
			{
				InventoryItem newInventoryItem = new InventoryItem();
				newInventoryItem.GenerateNewInventoryItem(Storage.LoadById<RPGItem>(requiredItems[i].TaskTarget, new RPGItem()), requiredItems[i].Tasklevel, requiredItems[i].AmountToReach);
			}
		}
	}
开发者ID:reaganq,项目名称:MagnetBots_unity,代码行数:10,代码来源:RPGConstruction.cs

示例3: DisplayQuestItems

	public void DisplayQuestItems()
	{
		questItemsGrid.SetActive(true);
		questItems.Clear();
		for (int i = 0; i < activeQuestStep.Tasks.Count; i++) {
			if(activeQuestStep.Tasks[i].TaskType == TaskTypeEnum.BringItem)
			{
				InventoryItem item = new InventoryItem();
				if(activeQuestStep.Tasks[i].PreffixTarget == PreffixType.ARMOR)
				{
					item.GenerateNewInventoryItem(Storage.LoadById<RPGArmor>(activeQuestStep.Tasks[i].TaskTarget, new RPGArmor()), activeQuestStep.Tasks[i].Tasklevel, activeQuestStep.Tasks[i].AmountToReach);
				}
				else if(activeQuestStep.Tasks[i].PreffixTarget == PreffixType.ITEM)
				{
					item.GenerateNewInventoryItem(Storage.LoadById<RPGItem>(activeQuestStep.Tasks[i].TaskTarget, new RPGItem()), activeQuestStep.Tasks[i].Tasklevel, activeQuestStep.Tasks[i].AmountToReach);
				}
				questItems.Add(item);
			}
		}
		int num = questItems.Count - itemTiles.Count;
		if(num>0)
		{
			for (int i = 0; i < num; i++) {
				GameObject itemTile = NGUITools.AddChild(questItemsPanelGrid.gameObject, itemTilePrefab);
				ItemTileButton tileButton = itemTile.GetComponent<ItemTileButton>();
				itemTiles.Add(tileButton);
				tileButton.index = itemTiles.Count-1;
			}
		}
		for (int i = 0; i < itemTiles.Count; i++) {
            if(i>=questItems.Count)
            {
                itemTiles[i].gameObject.SetActive(false);
            }
            else
            {
                itemTiles[i].gameObject.SetActive(true);
                itemTiles[i].LoadQuestDisplayTile(questItems[i], false);
            }
            questItemsPanelGrid.Reposition();
        }
		questItemsPanelGrid.Reposition();
	}
开发者ID:reaganq,项目名称:MagnetBots_unity,代码行数:43,代码来源:QuestPage.cs

示例4: UpdatePlayerShopitemList

	public void UpdatePlayerShopitemList(List<ParseInventoryItem> items)
	{
		List<InventoryItem> newItemList = new List<InventoryItem>();
		for (int i = 0; i < items.Count; i++) 
		{
			InventoryItem newItem = new InventoryItem();
			if(items[i].UniqueItemId.IndexOf("ARMOR") != -1)
			{
				newItem.GenerateNewInventoryItem(Storage.LoadbyUniqueId<RPGArmor>(items[i].UniqueItemId, new RPGArmor()), items[i].ItemLevel, items[i].Amount);
			}
			else if(items[i].UniqueItemId.IndexOf("ITEM") != -1)
			{
				newItem.GenerateNewInventoryItem(Storage.LoadbyUniqueId<RPGItem>(items[i].UniqueItemId, new RPGItem()), items[i].ItemLevel, items[i].Amount);
			}
			newItemList.Add(newItem);
		}
		selectedItemList = newItemList;
		RefreshInventoryIcons();
	}
开发者ID:reaganq,项目名称:MagnetBots_unity,代码行数:19,代码来源:ShopGUIController.cs

示例5: TakeItemsFromPlayer

	public void TakeItemsFromPlayer()
	{
		foreach(Task task in Tasks)
		{
			if(task.TaskType == TaskTypeEnum.BringItem && task.CanTaskBeFinished())
			{
				InventoryItem item = new InventoryItem();
				if(task.PreffixTarget == PreffixType.ARMOR)
				{
					item.GenerateNewInventoryItem(Storage.LoadById<RPGArmor>(task.TaskTarget, new RPGArmor()), task.Tasklevel, task.AmountToReach - task.CurrentAmount);
					PlayerManager.Instance.Hero.RemoveItem(item);
					task.CurrentAmount += (task.AmountToReach - task.CurrentAmount);
				}
				else if(task.PreffixTarget == PreffixType.ITEM)
				{
					item.GenerateNewInventoryItem(Storage.LoadById<RPGItem>(task.TaskTarget, new RPGItem()), task.Tasklevel, task.AmountToReach - task.CurrentAmount);
					task.CurrentAmount += (task.AmountToReach - task.CurrentAmount);
				}
			}
		}
	}
开发者ID:reaganq,项目名称:MagnetBots_unity,代码行数:21,代码来源:QuestStep.cs

示例6: GenerateRandomReward

	public void GenerateRandomReward()
	{
		/*int id = Random.Range(6, 15);
		LootItem loot = new LootItem();
		loot.itemID.Add(id);
		loot.itemType = ItemType.Armor;
		loot.minQuantity = 1;
		loot.maxQuantity = 1;
		loot.itemLevel = 1;
		loot.dropRate = 1;
		return loot;*/
		InventoryItem item = new InventoryItem();
		item.GenerateNewInventoryItem( Storage.LoadById<RPGArmor>(Random.Range(5,16), new RPGArmor()), 1, 1);
		rewardItem = item;
		rewardItemInfo.LoadItemInfo(rewardItem);
	}
开发者ID:reaganq,项目名称:MagnetBots_unity,代码行数:16,代码来源:CombobulatorGUIController.cs

示例7: LoadNakedArmors

	public void LoadNakedArmors()
	{
		StartCoroutine(MoveCamera(introCutscene.interiorCamera, 0.3f, quickSingleInventoryCameraRectOffset));
		Debug.Log("load naked armor times!");
		nakedArmorPanelTween.Play(true);
		for (int i = 0; i < NakedArmorIDs.Length; i++) {
			//load in naked armors
			RPGArmor nakedArmor = Storage.LoadById<RPGArmor>(NakedArmorIDs[i], new RPGArmor());
			InventoryItem newItem = new InventoryItem();
			newItem.GenerateNewInventoryItem(nakedArmor, 1, 1);
			NakedArmors.Add(newItem);
			//newItem.GenerateNewInventoryItem(
		}
		LoadItemTiles(NakedArmors, itemTiles, inventoryGridRoot, itemTilePrefab, inventoryType);
		nakedArmorPanelGrid.Reposition();
		Invoke("DisplayTip", tipWaitTime);
	}
开发者ID:reaganq,项目名称:MagnetBots_unity,代码行数:17,代码来源:OpeningCinematicGUIController.cs

示例8: UpgradeItem

	public IEnumerator UpgradeItem()
	{
		doorsAnimation.Play();
		yield return new WaitForSeconds(0.8f);
		HidePageComponents();
		//play doors animation
		float luck = Random.Range(0.0f, 1.0f);
		Debug.Log("luck " + luck);
		float chance = usingBonus? 0.85f : 0.55f;
		if(usingBonus)
			PlayerManager.Instance.Hero.RemoveCurrency(bonusMagnetsCount, BuyCurrencyType.Magnets);
		//TODO block bonus usage when there isn't enough magnets
		
		if(luck < chance)
		{
			InventoryItem FinalItem = new InventoryItem();
			FinalItem.GenerateNewInventoryItem(selectedItem.rpgItem, selectedItem.Level +1, 1);
		
			PlayerManager.Instance.Hero.AddItem(FinalItem);
			PlayerManager.Instance.Hero.RemoveItem(selectedItem, 1);
			upgradedItem = PlayerManager.Instance.Hero.FindItem(FinalItem.rpgItem, FinalItem.Level);
			DisplaySuccessPage();
		}
		else
		{
			upgradedItem = null;
			PlayerManager.Instance.Hero.RemoveItem(selectedItem, 1);
			DisplayFailurePage();
		}
		yield return null;
		//play door animations
	}
开发者ID:reaganq,项目名称:MagnetBots_unity,代码行数:32,代码来源:InventoryGUIController.cs


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