using UnityEngine;
using System.Collections;

public class MovimentacaoPlataforma : MonoBehaviour {

	public float velocidade;
	public float x;

	private Rigidbody2D rb;

	// Use this for initialization
	void Start () {
		rb = GetComponent<Rigidbody2D> ();
	}
	
	// Update is called once per frame
	void Update () {
		if(velocidade!=0){
			GetComponent<Rigidbody2D> ().velocity = new Vector2 (velocidade,0);
		}
	}
	void OnBecameInvisible(){
		transform.position = new Vector3(x,transform.position.y,transform.position.z);
	}    
}
