예제 #1
0
    private void OnPlayerWins(Player winningPlayer)
    {
        IEnumerable <MonoBehaviour> controllers   = GameObject.FindObjectsOfType <Controlls>();
        IEnumerable <MonoBehaviour> deathTriggers = GameObject.FindObjectsOfType <DeathTrigger>();

        var componentsToDisable = controllers.Concat(deathTriggers);

        foreach (var component in componentsToDisable)
        {
            component.enabled = false;
        }

        foreach (var audioSource in audioSourcesToDeactivate)
        {
            audioSource.enabled = false;
        }

        gameOverScreen.SetWinningPlayer(winningPlayer);
        gameRestartController.enabled = true;
    }