Exemplo n.º 1
0
    public static Char_Mod_WorldItem SpawnWorldItem(Char_Mod_Item item, Vector3 position)
    {
        Transform transform = Instantiate(Char_Mod_ItemAssets.Instance.pfWorldItem, position, Quaternion.identity);

        Char_Mod_WorldItem worldItem = transform.GetComponent <Char_Mod_WorldItem>();

        worldItem.SetItem(item);
        return(worldItem);
    }
Exemplo n.º 2
0
    private void OnTriggerStay(Collider other)
    {
        Char_Mod_WorldItem worldItem = other.GetComponent <Char_Mod_WorldItem>();

        if (worldItem != null)
        {
            //Touching item
            if (Input.GetKeyDown(KeyCode.E))
            {
                inventory.AddItem(worldItem.GetItem());
                worldItem.DestroySelf();
            }
        }
    }