Exemplo n.º 1
0
 public void UnequipFromPlayerModel(EquipableWorldItem item)
 {
     for (int i = 0; i < item.equipToPlayerParts.Length; i++)
     {
         item.equipToPlayerParts[i].GetComponent <SpriteRenderer>().sprite = null;
     }
 }
Exemplo n.º 2
0
 public void InsertToEquippedDict(EquipableWorldItem worldItem)
 {
     if (equippedDict.ContainsKey(worldItem.GetMyItemType()))
     {
         equippedDict[worldItem.GetMyItemType()] = worldItem;
     }
     else
     {
         equippedDict.Add(worldItem.GetMyItemType(), worldItem);
     }
 }
Exemplo n.º 3
0
 public void InitialiseEquippedItemsDict()
 {
     //OpenInventory();
     equipmentSlots = FindObjectsOfType <PlayerEquipmentSlot>();
     foreach (PlayerEquipmentSlot equipmentSlot in equipmentSlots)
     {
         if (equipmentSlot.transform.childCount > 0)
         {
             EquipableWorldItem item = equipmentSlot.transform.GetChild(0).GetComponent <EquipableWorldItem>();
             Debug.Log(item.name);
             if (item != null)
             {
                 InsertToEquippedDict(item);
             }
         }
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Iterates the array of sprites related to the player model and sets them to the
 /// counterparts attached to the world item's children.
 /// </summary>
 /// <param name="item"></param>
 public void EquipToPlayerModel(EquipableWorldItem item)
 {
     item.SetWorldSpritesActive(true);
     for (int i = 0; i < item.transform.childCount; i++)
     {
         if (item.transform.GetChild(i).GetComponent <SpriteRenderer>().sprite != null)
         {
             item.equipToPlayerParts[i].GetComponent <SpriteRenderer>().sprite =
                 item.transform.GetChild(i).GetComponent <SpriteRenderer>().sprite;
             item.equipToPlayerParts[i].GetComponent <SpriteRenderer>().material =
                 item.transform.GetChild(i).GetComponent <SpriteRenderer>().material;
         }
         else
         {
             item.equipToPlayerParts[i].GetComponent <SpriteRenderer>().sprite = null;
         }
     }
     questsUI.CompleteEquipItemTaskPart(item.gameObject.name);
 }