コード例 #1
0
 public void EquipItem(ItemScript item)
 {
     if (playerStats == null)
     {
         print("Error in PlayerInvetory EquipItem 81\n");
         return;
     }
     if (item.GetItemName() == "Ring")
     {
         if (playerRing1 != null)
         {
             playerRing1 = item;
             playerStats.AddToStats(item);
             itemCount--;
         }
         else if (playerRing2 != null)
         {
             playerRing2 = item;
             playerStats.AddToStats(item);
             itemCount--;
         }
     }
     else if (item.GetItemName() == "Amulet")
     {
         if (playerAmulet1 != null)
         {
             playerAmulet1 = item;
             playerStats.AddToStats(item);
             itemCount--;
         }
         else if (playerAmulet2 != null)
         {
             playerAmulet2 = item;
             playerStats.AddToStats(item);
             itemCount--;
         }
     }
 }
コード例 #2
0
 private void OnMouseDown()
 {
     if (itemViewDetailSpriteRenderer == null || cameraManager == null || spriteRenderer == null || item == null)
     {
         print("Error in InventoryItemDisplay OnMouseDown 43\n");
         return;
     }
     itemViewDetailSpriteRenderer.sprite = item.GetSprite();
     itemNameText.text = "Item Name: " + item.GetItemName();
     defenseText.text  = "Defense: " + item.GetDefenseBoost().ToString();
     meeleText.text    = "Meele Attack: " + item.GetMeeleBoost().ToString();
     rangedText.text   = "Ranged Attack: " + item.GetRangedBoost().ToString();
     hungerText.text   = "Hunger: " + item.GetHungerBoost().ToString();
     thirstText.text   = "Thirst: " + item.GetThirstBoost().ToString();
     weightText.text   = "Weight: " + item.GetItemWeight().ToString();
     cameraManager.SendMessage("ActivateItemViewDetail");
     equipItemButton.SetInventoryItemDisplay(this);
 }