using UnityEngine;
using System.Collections;

public class PlatformSwing : MonoBehaviour {
	
	public float rate = 1;
	public float distance = 1;
	public float phase = 0;
	private float timec;
	
	// Use this for initialization
	void Start () {
		timec = 0;
	}

	// Update is called once per frame
	void Update () {
		timec += Time.deltaTime;
		Vector3 p = gameObject.transform.localPosition;
		p.x = Mathf.Sin(timec * rate) * distance + phase;
		gameObject.transform.localPosition = p;
	}
}
