Beispiel #1
0
 public static string GetCountText(int count, ClickTool clickTool)
 {
     if (clickTool.infiniteCharges)
     {
         return("");
     }
     return(count > 0 ? count + "\nleft" : "0");
 }
Beispiel #2
0
 private ClickTool GetClickTool()
 {
     if (clickTool == null)
     {
         clickTool = FindObjectOfType <ClickTool>();
     }
     return(clickTool);
 }
Beispiel #3
0
    private int GetToolCharges(int toolIndex)
    {
        ClickTool clickTool = FindObjectOfType <ClickTool>();

        if (toolIndex < clickTool.toolCharges.Length)
        {
            return(clickTool.toolCharges[toolIndex]);
        }
        return(0);
    }
Beispiel #4
0
    public void UpdateSelectedToolAppearance()
    {
        int toolIndex = (int)selectedTool;

        selectedToolImage.sprite = GetToolSprite(toolIndex);

        ClickTool clickTool = FindObjectOfType <ClickTool>();
        int       count     = GetToolCharges(toolIndex);

        selectedToolCount.text = ToolSelectUI.GetCountText(count, clickTool);

        GetCreateObjectUI().SetShowCursor(selectedTool == Tools.create);
    }
Beispiel #5
0
    private void SelectAnyAvailableTool()
    {
        ClickTool clickTool = FindObjectOfType <ClickTool>();

        for (int toolIndex = 0; toolIndex < clickTool.toolCharges.Length; toolIndex++)
        {
            if (clickTool.toolCharges[toolIndex] > 0)
            {
                SelectTool((Tools)toolIndex);
                break;
            }
        }
    }
Beispiel #6
0
    public void UpdateAppearance()
    {
        ClickTool clickTool = FindObjectOfType <ClickTool>();

        for (int i = 0; i < toolContainers.Length; i++)
        {
            int charges = clickTool.toolCharges[i];
            GetCountTexts()[i].text = GetCountText(charges, clickTool);
            if (charges < 1 && !clickTool.infiniteCharges)
            {
                MainMenu.SetUIVisibility(toolContainers[i], false);
            }
        }
    }
Beispiel #7
0
 private ClickTool GetClickTool()
 {
     if (clickTool == null)
         clickTool = FindObjectOfType<ClickTool>();
     return clickTool;
 }
Beispiel #8
0
 public static string GetCountText(int count,ClickTool clickTool)
 {
     if (clickTool.infiniteCharges)
         return "";
     return count > 0 ? count + "\nleft" : "0";
 }
Beispiel #9
0
    private bool ShouldShowToolCharges()
    {
        ClickTool clickTool = FindObjectOfType <ClickTool>();

        return(clickTool.HasAtLeastOneToolCharge() && gameMenuMode == GameMenuModes.gameplay);
    }