示例#1
0
    private void Update()
    {
        if (currItem != null)
        {
            itemName = currItem.item.display_name;
        }

        if (Input.GetMouseButtonUp(0) && gameMaster.uiHandler.currState == "")
        {
            for (int x = 0; x < inventory.GetLength(0); x++)
            {
                for (int y = 0; y < inventory.GetLength(1); y++)
                {
                    ItemEntity item = inventory[x, y];

                    if (item.isInitalized)
                    {
                        for (int i = 0; i < item.item.functions.Count; i++)
                        {
                            IItemFunction fnk = item.item.functions[i];
                            fnk.Initialize(gameMaster);
                            fnk.OnItemUsed(gameMaster.playerEntityController);
                        }
                    }
                }
            }
        }

        List <string> list = new List <string>();

        for (int x = 0; x < inventory.GetLength(0); x++)
        {
            for (int y = 0; y < inventory.GetLength(1); y++)
            {
                if (inventory[x, y] != null)
                {
                    list.Add(inventory[x, y].item.registry_Name);
                }
            }
        }

        inv_array = list.ToArray();
    }
示例#2
0
 private static bool TryGetFunctionFromCached(int key, out IItemFunction func)
 {
     return(_functionsCached.TryGetValue(key, out func));
 }