using UnityEngine;
using System.Collections;

public class ShakePosition : MonoBehaviour {

	public Vector3 distance;
	Vector3 startPosition;

	// Use this for initialization
	void Start () {
		startPosition = transform.position;
	}
	
	// Update is called once per frame
	void Update () {
		Vector3 n = startPosition;
		if(distance.x!=0)n.x+= Random.Range(-distance.x*0.5f, distance.x*0.5f);
		if(distance.y!=0)n.y+= Random.Range(-distance.y*0.5f, distance.y*0.5f);
		if(distance.z!=0)n.z+= Random.Range(-distance.z*0.5f, distance.z*0.5f);
		transform.position = n;
	}
}
