Пример #1
0
    public void setNewWeapon()
    {
        if (item is Weapon)
        {
            Player_weapons playerWeapons = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_weapons>();
            playerWeapons.setNewWeapon((Weapon)item);
            disableFrame();
            changeColor(Color.cyan);
        }
        if (item is Potion)
        {
            Debug.Log("Wchodze w SetNewWeapon do potek " + i++);
            Potion      potion      = (Potion)item;
            PlayerStats playerStats = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStats>();
            playerStats.addPotionValue(potion.healValue);
            InventoryMenu inventoryMenu = GameObject.FindGameObjectWithTag("Items").GetComponent <InventoryMenu>();
            //disableFrame();
            //changeColor(Color.cyan);

            PlayerInventory playerInventory = GameObject.FindGameObjectWithTag("GameManager").GetComponent <PlayerInventory>() as PlayerInventory;
            playerInventory.removeFromInventory(item);
            GameObject.Destroy(gameObject);
            inventoryMenu.updateInventory();
        }
    }
Пример #2
0
    public void highlightCurrentWeapon()
    {
        Player_weapons playerWeapons = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_weapons>();
        string         weaponName    = playerWeapons.getCurrentWeaponName();

        foreach (ItemFrame frame in listItemFrame)
        {
            if (frame.name.Equals(weaponName))
            {
                frame.changeColor(Color.cyan);
            }
        }
    }