Ejemplo n.º 1
0
    //For other things to be able to end the game. This takes a boolean parameter so don't forget that!!
    //!x is defeat, x is victory
    static public void end(bool x)
    {
        loadReferences();
        timer.pause();
        if (x)
        {
            /*           if (GameController.day == 5)
             *         {
             *             Debug.Log("You win!");
             *             endscreen.winscreen();
             *             reason.displaySleepHours();
             *         } else
             *         {*/
            Debug.Log("You win!");
            endscreen.dayendscreen();
            reason.displaySleepHours();
            // }
        }



        //turning off all the hitboxes
        GameObject[] clickables = GameObject.FindGameObjectsWithTag("Clickable");
        for (int i = 0; i < clickables.Length; i++)
        {
            //tries to disable boxcolliders and if fails tries polygons and if fails does nothing
            try {
                clickables[i].GetComponent <BoxCollider2D>().enabled = !clickables[i].GetComponent <BoxCollider2D>().enabled;
            } catch {
                try {
                    clickables[i].GetComponent <PolygonCollider2D>().enabled = !clickables[i].GetComponent <PolygonCollider2D>().enabled;
                } catch {
                }
            }
        }
    }