﻿using UnityEngine;
using System.Collections;

public class PizzaContainer : MonoBehaviour {


	private Vector3 rotateBy;

	// Use this for initialization
	void Start () {
	
		rotateBy = new Vector3(0,5,0);
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	
	public void FlingIt(Transform target)
	{
	
	
		Vector3 to;
		if (target != null)
			to = Vector3.MoveTowards(transform.position, target.position, 10 * Time.deltaTime);
		else 
			to = new Vector3(transform.position.x, transform.position.y, transform.position.z + (10 * Time.deltaTime)); 		

		transform.position = to;
			
		transform.Rotate (rotateBy);
				//transform.Translate (0, 0, 10 * Time.deltaTime);
		
	
	}
}
