using UnityEngine;
using System.Collections;

public class MasterBall : MonoBehaviour {


    private bool hit = false;
    private bool start = false;
    public GameObject pewpew;


    private float endGame = 10.0f;

    private Transform player;

	// Use this for initialization
	void Start () {
        player = FindObjectOfType<PlayerStats>().transform;
	
	}
	
	// Update is called once per frame
	void Update () {

        endGame -= Time.deltaTime;

        if (endGame < 0) {
            ScreenFader.instance.changeLevel("Dream6");
        }

        if (hit && !start) {
            start = true;
            Instantiate(pewpew, transform.position, transform.rotation);

        }

        if (start) {
            player.localScale *= 0.7f;
        }
	    
	}

    void OnCollisionEnter(Collision col) {
        hit = true;
    }
}
