public void ActivatePotion(InventoryMaster.InventoryItem theItem) { DataLogger.LogMessage("Potion Activated! " + theItem.item.name); if (isHijacked) { return; } Potion myPot = (Potion)theItem.item; PowerUpManager.s.EnablePowerUp(PowerUpManager.PUpTypes.potion, (int)myPot.myType, -1, myPot.amount, myPot.effectColor); if (!GS.a.customCharacterLevel) { InventoryMaster.s.Remove(theItem); } else { List <Potion> myPotions = new List <Potion> (GS.a.potions); int myIndex = myPotions.IndexOf(myPot); GS.a.potionsAmounts[myIndex]--; } DrawPotionScreen(); }
public void SetUp(InventoryMaster.InventoryItem item) { if (item != null) { SetUp(item.item.sprite, item.item.name, item.item.description, item.chargesLeft, new int[0], new int[0], new Sprite[0]); } }
// Use this for initialization public void SetUp(InventoryMaster.InventoryItem _item) { myItem = _item; if (toolTip != null) { Destroy(toolTip); } toolTip = Instantiate(tooltipPrefab, GetComponentInParent <CanvasScaler> ().transform); toolTip.GetComponentInChildren <TextMeshProUGUI> ().text = myItem.item.description; toolTip.SetActive(false); myIcon.sprite = myItem.item.sprite; myName.text = myItem.item.name; myAmount.text = myItem.chargesLeft.ToString() + "x"; if (myItem.item is Ingredient) { if (((Ingredient)myItem.item).isQuestItem) { if (GetComponent <Image>()) { GetComponent <Image> ().color = questItemColor; } } } }
public void ShowGainedItem(InventoryMaster.InventoryItem item) { myDetailsObject = Instantiate(myDetailsPrefab, myPanel.transform); myDetailsObject.GetComponentInChildren <ItemInfoDisplay> ().SetUp(item); myDetailsObject.SetActive(true); openScreensCount++; myPanel.SetActive(true); if (itemGainedCall != null) { itemGainedCall.Invoke(); } if (LocalPlayerController.s != null) { LocalPlayerController.s.canSelect = false; playerFlag = true; } /*if (GameObjectiveFinishChecker.s != null && GS.a.myGameType == GameSettings.GameType.Singleplayer) { * GameObjectiveFinishChecker.s.isGamePlaying = false; * gameFlag = true; * }*/ }
public void ShowDurabilityLoss(InventoryMaster.InventoryItem item) { beforeAmount.text = (item.chargesLeft + 1).ToString() + "x"; itemExplodedSprite.SetActive(item.chargesLeft == 0); myDetailsObject = Instantiate(myDetailsPrefab, myPanel.transform); myDetailsObject.GetComponentInChildren <ItemInfoDisplay> ().SetUp(item); myDetailsObject.SetActive(true); openScreensCount++; myPanel.SetActive(true); if (itemGainedCall != null) { itemGainedCall.Invoke(); } if (LocalPlayerController.s != null) { LocalPlayerController.s.canSelect = false; playerFlag = true; } /*if (GameObjectiveFinishChecker.s != null && GS.a.myGameType == GameSettings.GameType.Singleplayer) { * GameObjectiveFinishChecker.s.isGamePlaying = false; * gameFlag = true; * }*/ }
public void Show(InventoryMaster.InventoryItem item) { myItem = item; itemName.text = myItem.item.name; sprite.sprite = myItem.item.sprite; if (myItem.item is Equipment) { tooltip.SetUp(myItem.item.description, ((Equipment)myItem.item).chargeReq); equipButton.SetActive(true); } else { tooltip.SetUp(myItem.item.description); equipButton.SetActive(false); } panel.SetActive(true); }