﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using Photon.Pun;

public class OutOfBounds : MonoBehaviour {

	void OnTriggerEnter (Collider col) {
		if (col.gameObject.tag == "Player"){
			if (col.gameObject.GetPhotonView () && !col.gameObject.GetPhotonView ().IsMine && PhotonNetwork.IsConnected)
				return;

			if (SceneManager.GetActiveScene ().name == "GameIsland") {
				col.gameObject.GetComponent<PlayerBase> ().outOfBounds = true;
				col.gameObject.GetComponent<PlayerBase> ().playerHealth = -100f;
			} else {
				col.gameObject.transform.position = new Vector3 (0f, 201f, 0f);
			}
		}
	}
}
