Esempio n. 1
0
 public void updateNumberAndSprite()
 {
     // Debug.Log("35 "+H_potion + " / " + S_potion + " /  "+Key);
     H_PotionNum.GetComponent <Text>().text = H_potion + " / " + maxH_potion;
     S_PotionNum.GetComponent <Text>().text = S_potion + " / " + maxS_potion;
     KeyNum.GetComponent <Text>().text      = Key + " / ?";
     if (H_potion <= 0)
     {
         H_potion = 0;
         H_PotionSlot.GetComponent <Image>().sprite = H_PotionSpriteGrey;
     }
     else
     {
         H_PotionSlot.GetComponent <Image>().sprite = H_PotionSprite;
     }
     if (S_potion <= 0)
     {
         S_potion = 0;
         S_PotionSlot.GetComponent <Image>().sprite = S_PotionSpriteGrey;
     }
     else
     {
         S_PotionSlot.GetComponent <Image>().sprite = S_PotionSprite;
     }
     if (Key <= 0)
     {
         Key = 0;
         KeySlot.GetComponent <Image>().sprite = KeySpriteGrey;
     }
     else
     {
         KeySlot.GetComponent <Image>().sprite = KeySprite;
     }
 }
Esempio n. 2
0
    public void PlaceIntoSlot(GameObject keySlot)
    {
        // Lets us turn off the component to prevent duplicate placements
        if (!enabled)
        {
            return;
        }

        KeySlot slot = keySlot.GetComponent <KeySlot>();

        if (!slot)
        {
            Debug.LogError("No KeySlot component was found on " + keySlot.name, keySlot);
            return;
        }

        if (slot.IsFilled)
        {
            return;
        }

        slot.InsertKey();
        SaveKeySlot(slot.guidGenerator.uniqueId);
        RemoveMe();
    }