Ejemplo n.º 1
0
    /**
     * This function will check how many levels has the player cleared and then mark the correct amount of buttons as clickable
     * Additionally this function will hide all the cats that the player has not yet acquired.
     */
    private void checkButtons()
    {
        int clearedlevels = system.getClearedLevels();

        for (int i = 0; i < buttons.Capacity; i++)
        {
            if (clearedlevels >= i)
            {
                buttons[i].interactable = true;
                if (system.isCatCollected(i))
                {
                    GameObject.Find("Main Canvas/Buttons/Level" + (i + 1) + "/cat_l" + (i + 1)).SetActive(true);
                }
            }
            else if (clearedlevels < i)
            {
                buttons[i].interactable = false;
                GameObject.Find("Main Canvas/Buttons/Level" + (i + 1) + "/cat_l" + (i + 1)).SetActive(false);
            }

            /*
             * if(i == (buttons.Capacity - 1) && !system.isCatCollected(i))                                      //makes sure that the number of cats being displayed is correct
             * {
             *  GameObject.Find("Main Canvas/Buttons/Level" + (i+1) + "/cat_l" + (i+1)).SetActive(false);
             * }
             */
        }
    }
Ejemplo n.º 2
0
 /**
  * Game state that is triggered if the user's answer was correct.
  * Prompts the user that they have acquired a cat if not collected before.
  * Also prompts the user to play the next level or to quit.
  */
 void gameWin()
 {
     Debug.Log("You win!");
     playable = false;
     if (!system.isCatCollected(currentLevel))       //if first time clear
     {
         system.collectCat(currentLevel);
         system.clearlevel(currentLevel);
         activateCatPrompt();
     }
     else
     {
         system.clearlevel(currentLevel);
         activateWinPrompt();
     }
 }