public void Click()
    {
        UIMouseFollow follow = FindObjectOfType <UIMouseFollow>();

        if (myItem == null)
        {
            if (follow.myItem != null)
            {
                try
                {
                    myItem         = (Weapon)follow.myItem;
                    myImage.sprite = myItem.sprite;
                    follow.RemoveItem();
                }
                catch (System.InvalidCastException)
                {
                    Debug.Log("follow Item not a Weapon");
                    return;
                }
            }
        }
        else
        {
            follow.AssignItem(myItem);
            myItem         = null;
            myImage.sprite = null;
        }

        FindObjectOfType <AddonsController>().OnEnable();
        FindObjectOfType <StatController>().OnEnable();
    }
예제 #2
0
    public void Click()
    {
        UIMouseFollow follow = FindObjectOfType <UIMouseFollow>();

        if (myAddon == null)
        {
            if (follow.myItem != null)
            {
                SynthSphere sphere = null;
                try { sphere = (SynthSphere)follow.myItem; } catch (System.InvalidCastException) {  }
                try
                {
                    if (sphere != null && myIndex != 0)
                    {
                        Debug.Log("Only slot 1 may have a SynthSphere.");
                    }
                    else
                    {
                        myAddon = (Addon)Instantiate(follow.myItem);
                        modifySlot.myItem.data.addons[myIndex] = myAddon.stats;
                        follow.RemoveItem();
                    }
                }
                catch (System.InvalidCastException)
                {
                    Debug.Log("follow Item not an Addon");
                    return;
                }
            }
        }
        else
        {
            if (follow.myItem == null)
            {
                follow.AssignItem(myAddon);
                modifySlot.myItem.data.addons[myIndex] = new StatData();
                myAddon = null;
            }
        }

        FindObjectOfType <AddonsController>().OnEnable();
        FindObjectOfType <StatController>().OnEnable();
    }
    public void Click()
    {
        UIMouseFollow follow = FindObjectOfType <UIMouseFollow>();

        if (myItem == null)
        {
            if (follow.myItem != null)
            {
                myItem = follow.myItem;
                follow.RemoveItem();
                GameController.Instance.gameData.playerInfo.SetItemInInventory(myIndex, myItem);
            }
        }
        else if (follow.myItem == null)
        {
            follow.AssignItem(myItem);
            myItem = null;
            GameController.Instance.gameData.playerInfo.RemoveItemFromInventory(myIndex);
        }

        FindObjectOfType <InventoryController>().OnEnable();
    }