Exemplo n.º 1
0
 public void TurnOffUI()
 {
     //Turn off all the GUI elements
     selectedUI.SetActive(false);
     UIcanvas.SetActive(false);
     UIgoop.SetActive(false);
     UIhoney.SetActive(false);
     UIjelly.SetActive(false);
     UIpropolis.SetActive(false);
 }
Exemplo n.º 2
0
    public void Select(Cell selectedCell)
    {
        //Activate GUI
        selectedUI.SetActive(true);
        currentCell = selectedCell;
        if (isOn && selectedCell.ofType != "polen")
        {
            UIcanvas.SetActive(true);
            Debug.Log("Activating the right UI");
            if (selectedCell.ofType == "empty")
            {
                UIgoop.SetActive(true);
                if (pStats.stats.propolis >= 3)
                {
                    UIgoop.GetComponent <Button>().interactable = true;
                }
                else
                {
                    UIgoop.GetComponent <Button>().interactable = false;
                }
            }
            else
            {
                //Check if the selected cell is a royal jelly cell
                //Also check if the player has only one royal cell
                //If that is met it means that the player selected its only royal jelly cell and cannot modify it
                if (selectedCell.ofType == "potJelly" && pStats.stats.royalCellCount <= 1)
                {
                    TurnOffUI();
                    UIhoney.SetActive(true);
                    UIhoney.GetComponent <Button>().interactable = false;
                    UIpropolis.SetActive(true);
                    UIpropolis.GetComponent <Button>().interactable = false;
                    UIgoop.SetActive(true);
                    UIgoop.GetComponent <Button>().interactable = false;
                }
                //Else he can edit any he wants
                else
                {
                    //Only activates the right GUI

                    if (pStats.stats.propolis >= 5)
                    {
                        UIhoney.GetComponent <Button>().interactable = true;
                    }
                    else
                    {
                        UIhoney.GetComponent <Button>().interactable = false;
                    }
                    if (currentCell.ofType != "potHoney")
                    {
                        UIhoney.SetActive(true);
                    }

                    if (pStats.stats.propolis >= 15)
                    {
                        UIjelly.GetComponent <Button>().interactable = true;
                    }
                    else
                    {
                        UIjelly.GetComponent <Button>().interactable = false;
                    }
                    if (currentCell.ofType != "potJelly")
                    {
                        UIjelly.SetActive(true);
                    }

                    if (pStats.stats.propolis >= 7)
                    {
                        UIpropolis.GetComponent <Button>().interactable = true;
                    }
                    else
                    {
                        UIpropolis.GetComponent <Button>().interactable = false;
                    }
                    if (currentCell.ofType != "potPropolis")
                    {
                        UIpropolis.SetActive(true);
                    }

                    if (pStats.stats.propolis >= 3)
                    {
                        UIgoop.GetComponent <Button>().interactable = true;
                    }
                    else
                    {
                        UIgoop.GetComponent <Button>().interactable = false;
                    }
                    if (currentCell.ofType != "goop")
                    {
                        UIgoop.SetActive(true);
                    }
                }
            }
            Debug.Log("Waiting for input");
        }
    }