using UnityEngine;
using System.Collections;

public class Fall : MonoBehaviour 
{
	public Transform player1;
	public Transform player2;

	bool on1;
	bool on2;

	void FixedUpdate()
	{
		if (on1)
		{
			player1.rigidbody2D.velocity = new Vector2 (0, -50);
		}

		if (on2)
		{
			player2.rigidbody2D.velocity = new Vector2 (0, -50);
		}
	}

	void OnTriggerEnter2D(Collider2D col)
	{
		if(col.gameObject.tag == "Player1")
		{
			on1 = true;
		}

		if(col.gameObject.tag == "Player2")
		{
			on2 = true;
		}
	}
	
	void OnTriggerExit2D(Collider2D col)
	{
		if(col.gameObject.tag == "Player1")
		{
			on1 = false;
		}

		if(col.gameObject.tag == "Player2")
		{
			on2 = false;
		}
	}
}
