using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class goalScript3 : MonoBehaviour {

	public void OnTriggerEnter2D(Collider2D other){
		if (other.name == "Player") {
			GetComponent<AudioSource> ().Play ();
			((Fade)(GameObject.Find("Fade").GetComponent (typeof(Fade)))).setSpeed(0.02F);
			((Fade)(GameObject.Find("Fade").GetComponent (typeof(Fade)))).setNext("menuPrincipal");
			((Fade)(GameObject.Find("Fade").GetComponent (typeof(Fade)))).setGagne (true);
			((Fade)(GameObject.Find ("Fade").GetComponent (typeof(Fade)))).fadeIn ();
			((PlayerScript)other.gameObject.GetComponent (typeof(PlayerScript))).addBonus (false);
			((PlayerScript)other.gameObject.GetComponent (typeof(PlayerScript))).debugBonus ();
			//SceneManager.LoadScene ("Level1");
		}
	}
}