using UnityEngine;
using System.Collections;

public class WaterSpit : MonoBehaviour {

	private float count;

	// Use this for initialization
	void Start () {
		transform.position += 2.5f * transform.forward;
	}
	
	// Update is called once per frame
	void Update () {
		bool beforeX = transform.position.x < 0;
		transform.position += 20 * Time.deltaTime * transform.forward;
		count += Time.deltaTime;
		if (count > 10) {
			Destroy(gameObject);
		}
		if (beforeX != transform.position.x < 0) {
			Destroy(gameObject);
		}
	}
}
