using UnityEngine;
using System.Collections;

public class GameManager : MonoBehaviour {
	public bool bSquirrelWin, bFoxWin;
	public GameObject goContinue, goFoxWin, goSquirrelWin;
	public int iFoxScore, iSquirrelScore;
	// Use this for initialization
	void Awake () {

	}
	void Start ()
	{

	}
	void OnLevelWasLoaded ()
	{


	}
	// Update is called once per frame
	void Update ()
	{

		if(goSquirrelWin == null || goFoxWin == null || goContinue == null)
		{
			goContinue = GameObject.Find ("ContinuePanel");
			goFoxWin = GameObject.Find ("FoPanel");
			goSquirrelWin = GameObject.Find ("SqPanel");
			if (goFoxWin!=null) goFoxWin.SetActive (false);
			if (goSquirrelWin!=null) goSquirrelWin.SetActive (false);
			if (goContinue!=null) goContinue.SetActive (false);
		}

//		if(goSquirrelWin == null || goFoxWin == null || goContinue == null)
//		{
//			goContinue = GameObject.Find ("ContinuePanel");
//			goFoxWin = GameObject.Find ("FoPanel");
//			goSquirrelWin = GameObject.Find ("SqPanel");
//			goFoxWin.SetActive (false);
//			goSquirrelWin.SetActive (false);
//			goContinue.SetActive (false);
//		}

		if (bSquirrelWin)
		{
			SquirrelWin();
			GameFinished();
		}
		if (bFoxWin)
		{
			FoxWin();
			GameFinished();
		}
	}
	public void SquirrelWin()
	{
		goSquirrelWin.SetActive(true);
		iSquirrelScore++;
		//PlaySound
	}
	public void FoxWin()
	{
		goFoxWin.SetActive(true);
		iFoxScore++;
		//PlaySound
	}
	public void GameFinished()
	{
		goContinue.SetActive(true);
		bFoxWin = false;
		bSquirrelWin = false;
	}
}
