using UnityEngine;
using System.Collections;

public class GameManager : MonoBehaviour
{
    public static GameManager gameManagerRef;

    private int totalBlocks;
    private int blocksHit;
	
    void Start()
    {
        gameManagerRef = this;
        blocksHit = 0;
        totalBlocks = GameObject.FindGameObjectsWithTag("Block").Length;
    }

    public void HitBlock()
    {
        blocksHit++;
          
        if (blocksHit >= totalBlocks)
        {
            WonGame();
        }
    }

    public void WonGame()
    {
		Application.LoadLevel(Application.loadedLevel + 1);
    }

    public void LostBall()
    {
		Application.LoadLevel("Menu");
    }
}
