Exemple #1
0
    void Update()
    {
        //if in the game scene
        if (SceneManager.GetActiveScene() != SceneManager.GetSceneByBuildIndex(0))
        {
            //incress the puddle spawn timer
            puddleTimer += Time.deltaTime;

            //spawn the players if they dont exist
            if (spawnPlayers == true)
            {
                loadPlayers();
                spawnPlayers = false;
            }


            //spawns a random puddle
            SpawnPuddle();
        }

        //if the userInterfaceManager exist
        if (uim != null)
        {
            //if the current canvas is playerSelect
            if (uim.CurrentGameState == UserInterfaceManager.GameState.PlayerSelect)
            {
                //add a player if any of the controllers press a
                for (int i = 1; i < 5; i++)
                {
                    if (XCI.GetButtonDown(XboxButton.A, (XboxController)i) && !controllers.Contains((XboxController)i))
                    {
                        controllers.Add((XboxController)i);
                        uim.AddPlayer();
                    }
                }
            }
        }

        //check the if debug is true
        DebugUpdate();
    }