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

public class PlayerCollision : MonoBehaviour {

	public GameObject SceneManager;
	public GameObject Fade;

	void OnTriggerEnter(Collider other){
		if (other.gameObject.CompareTag ("Obstacle")) {
			Respawn ();
			Debug.Log ("u touched d butt");
			//TakeDamage
		} else if (other.gameObject.CompareTag ("End")) {
			SceneManager.GetComponent<SceneManager>().Menu();
			Fade.GetComponent<Fade>().startFade = false;
			Respawn ();
		}
		else if (other.gameObject.CompareTag("Fade")){
			//call fade
			Fade.GetComponent<Fade>().startFade = true;
		}
	}

	void Respawn(){
		transform.position = this.GetComponent<PlayerController> ().origPos;
	}
}
