Exemple #1
0
    private void PopulateToolbar()
    {
        int hotkey = 1;

        //Debug.Log(playerTools.GetEquiptTools().Count);
        foreach (var tool in playerTools.GetEquiptTools())
        {
            if (tool.GetType() == typeof(RepairTool))
            {
                gooGlueIndex = hotkey - 1;
            }
            var newTool = CreateToolBox();
            newTool.transform.SetParent(contentGroup.transform);

            var getObject = newTool.GetComponent <GetObjects>();
            getObject.GetToolText().SetText(tool.displayName);
            getObject.GetHotkeyText().SetText("[ " + hotkey.ToString() + " ]");
            getObject.GetButtonImage().sprite = enabledSprite;
            getObject.GetToolIcon().sprite    = tool.toolIcon;
            getObject.GetToolIcon().color     = enabledTextColour;

            toolList.Add(newTool);
            hotkey++;
        }
    }