예제 #1
0
    public bool Craft_Table(RaycastHit2D[] hits, Item tool, CraftType craftType, CraftTable craftTable)
    {
        GameObject GameObjOnTable = GetGameObjOnTable(hits);

        if (GameObjOnTable == null)
        {
            Debug.Log("TableIsEmpty");
            return(false);
        }

        Item itemOnTabe = GameObjOnTable.GetComponent <ItemCell>().item;


        ItemCraftData recept = FindRecept(tool, itemOnTabe, craftType, craftTable);

        if (recept == null)
        {
            Debug.Log("no recept");
            return(false);
        }

        if (!IsSuitableMinLvl(recept))
        {
            Debug.Log("recept lvl bigger then skill lvl");
            return(false);
        }

        Item craftResult = recept.recept.craftResult;

        // для вызова actionWindow
        if (itemOnTabe.itemOptionData.actionWindowTag != string.Empty)
        {
            Item _itemOnTabe  = Instantiate(itemOnTabe);
            Item _craftResult = Instantiate(craftResult);

            ActionWindowController actionWindow = Global.Component.GetActionWindowController();
            actionWindow.OpenActionWindow(itemOnTabe.itemOptionData.actionWindowTag);
            actionWindow.InitActioWindow(itemOnTabe.itemOptionData.actionWindowTag,
                                         GameObjOnTable,
                                         _itemOnTabe,
                                         _craftResult);


            //UpdateGameObjItem(GameObjOnTable, craftResult);

            return(recept.removeTool);
        }


        UpdateGameObjItem(GameObjOnTable, craftResult);

        AddExpReward(recept);

        return(recept.removeTool);
    }
예제 #2
0
    public void Open()
    {
        upper.SetTile(upper.WorldToCell(transform.position), baseTiles.GetSecondaryTile());
        isOpen = true;

        terminalController.SetCurrentPc(this);
        actionWindow.OpenActionWindow("awpc");

        terminalController.isOpen = true;
        //light2D.enabled = true;
    }
예제 #3
0
    public void Craft_Hands(GameObject itemInHand, GameObject toolGO)
    {
        Item tool = toolGO.GetComponent <ItemCell>().item;
        Item item = itemInHand.GetComponent <ItemCell>().item;

        // если активная рука пустая и айтес имеет функционал для открытия окна
        if (item.itemOptionData.actionWindowTag != string.Empty && controller.IsEmpty(toolGO.GetComponent <Button>()))
        {
            string tagWithPrefix = item.itemOptionData.actionWindowTag + "Hand";

            ActionWindowController actionWindow = Global.Component.GetActionWindowController();
            actionWindow.OpenActionWindow(tagWithPrefix);
            actionWindow.InitActioWindow(tagWithPrefix, null, item, null);
        }

        ItemCraftData recept = FindRecept(tool, item, CraftType.Cooking, CraftTable.Hands);

        if (recept == null)
        {
            Debug.Log("no recept");
            return;
        }

        if (!IsSuitableMinLvl(recept))
        {
            Debug.Log("recept lvl bigger then skill lvl");
            return;
        }

        Item craftResult = Instantiate(recept.recept.craftResult);

        // для передачи таков между айтемами (оригинальным и результатом)
        if (item.itemTimeflowModify.ticsTransition == true)
        {
            craftResult.itemTimeflowModify.tics = item.itemTimeflowModify.tics;
        }

        craftResult.itemEffect.currentCell        = itemInHand.GetComponent <Button>();
        itemInHand.GetComponent <ItemCell>().item = craftResult;
        itemInHand.GetComponent <Image>().sprite  = craftResult.itemSprite;
    }