using UnityEngine;
using System.Collections;

public class Position
{
	public float x;
	public float y;
	public float z;

	public float rotationY;
	public float rotationX;
	public float rotationZ;
	
	public Position()
	{
	}

	public Position(float x, float y, float z, float rotationY, float rotationX, float rotationZ)
	{
		this.x = x;
		this.y = y;
		this.z = z;	

		this.rotationX = rotationX;
		this.rotationY = rotationY;	
		this.rotationZ = rotationZ;
	}
	
	public string GetString()
	{
		return x + "," + y + "," + z + "," + rotationY + "," + (int) rotationX + "," + rotationZ;
	}

	public void ToPosition(string data)
	{
		string[] words = data.Split(',');
		for(int i=0; i<words.Length; i++)
		{
			switch(i)
			{
				case 0:
					this.x = float.Parse(words[i]);
					break;	
				case 1:
				this.y = float.Parse(words[i]);
					break;
				case 2:
				this.z = float.Parse(words[i]);
					break;
				case 3:
				this.rotationY =(int) float.Parse(words[i]);
					break;
				case 4:
				this.rotationX =(int) float.Parse(words[i]);
				break;				
				case 5:
				this.rotationZ =(int) float.Parse(words[i]);
					break;
			}
		}
	}
}