示例#1
0
    public void ActualizarSlotSacandoElItem(Item item)
    {
        List <SlotCtrl> hijos = new List <SlotCtrl>();

        transform.Find("ItemsParent").gameObject.GetComponentsInChildren(true, hijos);

        SlotCtrl slotConItem = BuscarSlotConItem(hijos, item);

        slotConItem.itemPrefab = null;
        slotConItem.ActualizarImagen(null);
    }
示例#2
0
    public void UsarItemEnLaPosicion(int unaPosicion)
    {
        List <SlotCtrl> hijos = new List <SlotCtrl>();

        transform.Find("ItemsParent").gameObject.GetComponentsInChildren(true, hijos);

        SlotCtrl slot = hijos[unaPosicion - 1];

        if (slot.itemPrefab != null && slot.itemPrefab.consumible)
        {
            GameObject.FindGameObjectWithTag("Player").GetComponent <JugadorCtrl>().UsarItem(slot.itemPrefab);
            QuitarItem(slot.itemPrefab);
            slot.itemPrefab = null;
            slot.ActualizarImagen(null);
        }
        if (slot.itemPrefab != null && slot.itemPrefab.nombreDeItem == "Bote")
        {
            GameObject.FindGameObjectWithTag("Player").GetComponent <JugadorCtrl>().UsarBote();
        }
    }