using UnityEngine;
using System.Collections;

public class IntroScript : MonoBehaviour {
	
	private int countdown = 25;

	// Use this for initialization
	void Start () {
		if (!PlayerPrefs.HasKey("bombs")) {
			PlayerPrefs.SetInt ("bombs",0);
		} else {
			PlayerPrefs.SetInt ("bombs",0);
		}
		if (!PlayerPrefs.HasKey("state")) {
			PlayerPrefs.SetInt ("state",0);
		} else {
			if (PlayerPrefs.GetInt ("state") > 0) {
				Application.LoadLevel ("puzzle0");
			}
		}
	}
	
	// Update is called once per frame
	void Update () {
		if (countdown > 0) {
			countdown -= 1;
			if (countdown <= 0) {
				camera.transform.Rotate(90,0,0);
				audio.Play ();
			}
		}
		if (Input.GetKeyDown ("space")) {
			Application.LoadLevel ("puzzle0");
		}
	}
}
