using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class endGame : MonoBehaviour {
    public PlayerMovement[] alivePlayers;
    private int count = 0;
    public Text winText;
	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
        for (int i= 0;i<alivePlayers.Length;i++)
        {
            if(alivePlayers[i].enabled==false)
            {
                count += 1;
            }
        }
        if (count >= alivePlayers.Length - 1)
        {
            winText.enabled = true;
            if (Input.GetButtonDown("Submit"))
            {
                SceneManager.LoadScene("PlayRoom");
            }
            if (Input.GetButtonDown("Cancel"))
            {
                SceneManager.LoadScene("MainMenu");
            }
        }
        else
        {
            count = 0;
        }
	}
}
