예제 #1
0
    public void Interact(GameObject interacter)
    {
        CharacterInventory charinventory = interacter.GetComponent <CharacterInventory>();

        if (item != null)
        {
            item.equipment.itemBehaviours.Add(BonusBehaviour.CreateInstance <BonusBehaviour>());
            charinventory.EquipItem(item.equipment);
        }
    }
예제 #2
0
    public void Interact(GameObject interacter)
    {
        CharacterInventory inventory = interacter.GetComponent <CharacterInventory>();

        Debug.Log("Interacted with!");

        if (inventory.CheckEmptySlot(EquipmentType.Helm))
        {
            Debug.Log("Loading Item!");
            EquipmentSaveData itemdata = (EquipmentSaveData)Resources.Load("Itemdata");


            inventory.EquipItem(itemdata.item1);
        }
    }
예제 #3
0
    // Draw Item icon with detail
    void DrawItemBoxDetail(ItemSlot itemslot, Vector2 position)
    {
        if (itemslot != null)
        {
            var item = character.itemManager.Items[itemslot.Index];
            GUI.Box(new Rect(10 + position.x, 10 + position.y, 50, 50), "");
            GUI.DrawTexture(new Rect(10 + position.x, 10 + position.y, 50, 50), item.Icon);
            GUI.skin.label.fontSize  = 13;
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUI.Label(new Rect(14 + position.x, 14 + position.y, 30, 30), itemslot.Num.ToString());
            GUI.skin.label.alignment = TextAnchor.MiddleLeft;
            GUI.Label(new Rect(position.x + 70, position.y, 100, 60), item.Name);

            switch (item.ItemType)
            {
            case ItemType.Weapon:
                if (character.CheckEquiped(itemslot))
                {
                    if (GUI.Button(new Rect(200 + position.x, position.y + 10, 80, 30), "UnEquipped"))
                    {
                        character.UnEquipItem(itemslot);
                    }
                }
                else
                {
                    if (GUI.Button(new Rect(200 + position.x, position.y + 10, 80, 30), "Equip"))
                    {
                        character.EquipItem(itemslot);
                    }
                }
                break;

            case ItemType.Edible:
                if (GUI.Button(new Rect(200 + position.x, position.y + 10, 80, 30), "Use"))
                {
                    character.UseItem(itemslot);
                }
                break;
            }
        }
    }