using UnityEngine;
using System.Collections;

public class WinController : MonoBehaviour {

    public GameObject canvas;
    public GameSave gameSave;

    public GameObject redWins;
    public GameObject blueWins;
    public UnityEngine.UI.Text redWinsText;
    public UnityEngine.UI.Text blueWinsText;

    bool gameOver = false;

    // Use this for initialization
    void Start () {
        gameSave = FindObjectOfType<GameSave>();
        canvas.SetActive(false);
        redWins.SetActive(false);
        blueWins.SetActive(false);
	}
	
	// Update is called once per frame
	void Update () {
	
	}

    public void playerWins(int playerID)
    {
        if (gameOver)
        {
            return;
        }
        gameOver = true;
        canvas.SetActive(true);
        if(playerID == 1)
        {
            gameSave.redWins += 1;
            redWins.SetActive(true);
            
        }
        else
        {
            gameSave.blueWins += 1;
            blueWins.SetActive(true);
        }
        redWinsText.text = "" + gameSave.redWins;
        blueWinsText.text = "" + gameSave.blueWins;
    }

}
