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

public class Wave : MonoBehaviour {

	private float myX, myY;

	// Use this for initialization
	void Start () 
	{
		myX = gameObject.transform.position.x;
		myY = gameObject.transform.position.y;
	}
	
	// Update is called once per frame
	void Update () {
		if (!(gameObject.transform.position.z > 0)) {
			gameObject.transform.position.Set (myX, myY, 550f);
		}
	}

	void OnTriggerEnter (Collider other)
	{
		if (other.gameObject.name == "Player") {
			other.gameObject.GetComponent<Player> ().Surfing = true;
		}	
	}

	void OnTriggerExit (Collider other)
	{
		if (other.gameObject.name == "Player") {
			other.gameObject.GetComponent<Player> ().Surfing = false;
		}
	}
}
