Ejemplo n.º 1
0
    public void OnPointerClick(PointerEventData eventData)
    {
        WearableItemScript  wScript = GetComponent <WearableItemScript> ();
        StackableItemScript sScript = GetComponent <StackableItemScript> ();

        InspectPanelScript script = GameObject.Find("InspectPanel").GetComponent <InspectPanelScript> ();

        script.setOnScreen();

        if (wScript != null)
        {
            script.setGeneral(wScript.getName(), wScript.getIcon());
            script.setStats(wScript.getSLot(), wScript.getPrimary(), wScript.getPrimaryVal(), wScript.getStatVal(), wScript.getVitality());
            script.setActions(wScript.Upgradable(), wScript.Disenchantable());
        }
        else if (sScript != null)
        {
            script.setGeneral(sScript.getName(), sScript.getIcon());
        }
    }
Ejemplo n.º 2
0
    public static Transform emptySlotStackable(string name, bool stackable, Sprite icon)
    {
        Transform firstEmptySlot = null;

        foreach (GameObject slot in slots)
        {
            if (slot.transform.childCount == 0 && firstEmptySlot == null)
            {
                firstEmptySlot = slot.transform;
                continue;
            }
            else if (slot.transform.childCount != 0 && slot.transform.GetChild(0).GetComponent <StackableItemScript> () != null)
            {
                StackableItemScript script = slot.transform.GetChild(0).GetComponent <StackableItemScript> ();
                if (slot.transform.GetChild(0).GetComponent <StackableItemScript> ().checkEqual(name, stackable, icon))
                {
                    slot.transform.GetChild(0).GetComponent <StackableItemScript> ().IncrementStack();
                }
                return(null);
            }
        }
        return(firstEmptySlot);
    }