Example #1
0
    public void UpdateGoals()
    {
        int goalsCompleted = 0;

        for (int i = 0; i < levelGoals.Length; i++)
        {
            currentGoals[i].thisText.text = "" + levelGoals[i].numberCollected + "/" + levelGoals[i].numberNeeded;
            if (levelGoals[i].numberCollected >= levelGoals[i].numberNeeded)
            {
                goalsCompleted++;
                currentGoals[i].thisText.text = "" + levelGoals[i].numberNeeded + "/" + levelGoals[i].numberNeeded;
            }
        }

        if (goalsCompleted >= levelGoals.Length)
        {
            if (endGame != null)
            {
                numberOfStar = scoreManager.GetComponent <ScoreManager>().numberStars;
                for (int i = 0; i < numberOfStar; i++)
                {
                    stars[i].SetActive(true);
                }
                //gameData.saveData.stars[board.level] = numberOfStar;
                StartCoroutine(endGame.WinGame());
                //endGame.WinGame();


                //gameData.Save();
            }
            Debug.Log("You Win");
        }
    }
Example #2
0
    public void UpdateGoals()
    {
        int goalsCompleted = 0;

        for (int i = 0; i < levelGoals.Length; i++)
        {
            currentGoals[i].thisText.text = "" + levelGoals[i].numberCollected + "/" + levelGoals[i].numberNeeded;

            if (levelGoals[i].numberCollected >= levelGoals[i].numberNeeded)
            {
                goalsCompleted++;
                currentGoals[i].thisText.text = "" + levelGoals[i].numberNeeded + "/" + levelGoals[i].numberNeeded;
            }
        }

        if (goalsCompleted >= levelGoals.Length) //если все цели выполнены
        {
            goalManagerAnimation.GetComponent <Animation>().Play("GoalContainer");

            if (endGame != null)
            {
                endGame.WinGame();

                board.currentState = GameState.wait;
            }
            Debug.Log("ПОБЕДААА");
        }
    }
Example #3
0
    public void UpdateGoals()
    { // mettre à jour les texts affichant les buts à atteindre
        int goalsCompleted = 0;

        for (int i = 0; i < levelGoals.Length; i++)
        {
            currentGoals[i].thisText.text = levelGoals[i].numberCollected + "/" + levelGoals[i].numberNeeded;
            if (levelGoals[i].numberCollected >= levelGoals[i].numberNeeded)
            {
                goalsCompleted++;
                currentGoals[i].thisText.text = levelGoals[i].numberNeeded + "/" + levelGoals[i].numberNeeded;
            }
        }
        if (goalsCompleted >= levelGoals.Length)
        {
            if (endGame != null)
            {
                endGame.WinGame();
                //Debug.Log("Partie gagnée");

                board.level++;
                if (board.level < board.world.levels.Length)
                {
                    board.Awake();
                }
            }
        }
    }
 private void UpdateBar()
 {
     if (board != null && scoreBar != null)
     {
         int length = board.scoreGoals.Length;
         scoreBar.fillAmount = (float)score / (float)board.scoreGoals[length - 1];
     }
     if (score >= board.scoreGoals[1])
     {
         endGame.WinGame();
         new WaitForSeconds(1f);
         board.currentState = GameState.paused;
     }
 }
Example #5
0
    public void UpdateGoals()
    {
        int goalsCompleted = 0;

        for (int i = 0; i < levelGoals.Length; i++)
        {
            currentGoals[i].thisText.text = "" + levelGoals[i].numberCollected + "/" + levelGoals[i].numberNeeded;
            if (levelGoals[i].numberCollected >= levelGoals[i].numberNeeded)
            {
                goalsCompleted++;
                currentGoals[i].thisText.text = "" + levelGoals[i].numberNeeded + "/" + levelGoals[i].numberNeeded;
            }
        }
        if (goalsCompleted >= levelGoals.Length)
        {
            if (endGame != null)
            {
                endGame.WinGame();
            }
            Debug.Log("You Win!");
        }
    }
Example #6
0
    // This function updates the goal text as well as keeps track of whether the goals have been completed
    public void UpdateGoals()
    {
        int goalsCompleted = 0;

        // Loop through all of the goals
        for (int i = 0; i < levelGoals.Length; i++)
        {
            currentGoals[i].thisText.text = "" + levelGoals[i].numberCollected + "/" + levelGoals[i].numberNeeded;

            if (levelGoals[i].numberCollected >= levelGoals[i].numberNeeded)
            {
                goalsCompleted++;
                currentGoals[i].thisText.text = "" + levelGoals[i].numberNeeded + "/" + levelGoals[i].numberNeeded;
            }
        }
        if (goalsCompleted >= levelGoals.Length)
        {
            if (endGame != null)
            {
                endGame.WinGame();
            }
        }
    }
Example #7
0
    public void UpdateGoals()
    {
        int goalsCompleted = 0;

        for (int i = 0; i < levelGoals.Length; i++)
        {
            currentGoals[i].thisText.text = "" + levelGoals[i].numberCollected + "/" + levelGoals[i].numberNeeded;

            if (levelGoals[i].numberCollected >= levelGoals[i].numberNeeded)
            {
                goalsCompleted++;
                currentGoals[i].thisText.text = "" + levelGoals[i].numberNeeded + "/" + levelGoals[i].numberNeeded;
            }
        }

        if (goalsCompleted >= levelGoals.Length /*|| scoreManager.score > board.scoreGoals[length-1]*/)
        {
            if (endGame != null)
            {
                endGame.WinGame();
            }
        }
    }
Example #8
0
    public void UpdateGoals()
    {
        int goalsCompleted = 0;

        for (int i = 0; i < levelGoals.Length; i++)
        {
            currentGoals[i].text.text = levelGoals[i].numberColected + "/" + levelGoals[i].numberNeeded;
            if (levelGoals[i].numberColected >= levelGoals[i].numberNeeded)
            {
                goalsCompleted++;
                currentGoals[i].text.text = levelGoals[i].numberNeeded + "/" + levelGoals[i].numberNeeded;
            }
        }
        if (goalsCompleted >= levelGoals.Length)
        {
            if (endGameManager != null)
            {
                endGameManager.WinGame();
                FadePanelController fade = FindObjectOfType <FadePanelController>();
                fade.GameOver();
                Debug.Log("You win!!");
            }
        }
    }