Esempio n. 1
0
    void CalculateNumberOfCollectedPieces()
    {
        int totalPlayerPieces = 0;

        // get the player health from the movment script
        for (int i = 0; i < playerHealthScripts.Count; i++)
        {
            totalPlayerPieces += (int)playerHealthScripts[i].health;
        }

        totalPlayerPieces = totalPlayerPieces - 2;  // Subract two to account for the player characters
        //these are for the save manager
        caughtBoys = totalPlayerPieces;

        TotalPlayerPieces pieceCounter = TotalPlayerPieces.instance;

        allBoys = pieceCounter.totalPlayerPieces - 2;
        TextMesh boyCountText = playerPieceCountText.GetComponent <TextMesh>();

        if (totalPlayerPieces < pieceCounter.totalPlayerPieces - 2 && totalPlayerPieces != 1)   // for > 1 camper
        {
            boyCountText.text = "You Collected " + totalPlayerPieces + " Campers!";
        }
        else if (totalPlayerPieces < pieceCounter.totalPlayerPieces - 2 && totalPlayerPieces == 1)  // for 1 camper
        {
            boyCountText.text = "You Collected " + totalPlayerPieces + " Camper!";
        }
        else if (totalPlayerPieces >= pieceCounter.totalPlayerPieces - 2)       // for all campers collected
        {
            boyCountText.text = "You Collected all the Campers!";

            // set the music to the wistle theme
            if (musicEmitter != null)
            {
                musicEmitter.Stop();
            }
            allCampersCollected = true;
        }
    }
Esempio n. 2
0
 private void Awake()
 {
     instance = this;
 }