using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class MonsterDraw : MonoBehaviour {
	
	public GameObject anchorPoint;


	private Vector2 anchorPos;

	void Start() 
	{
		anchorPos = new Vector2 (anchorPoint.transform.position.x, anchorPoint.transform.position.y);
		loadMonster();
	}

	public void loadMonster () 
	{
		string equippedString = PlayerPrefs.GetString("Equipped");
		string[] equipped = equippedString.Split (' ');

		for (int i = 0; i < equipped.Length - 1; i++) {
			string savedString = PlayerPrefs.GetString(equipped[i]);
			string[] values = savedString.Split ();
			GameObject instance = (GameObject)Instantiate(Resources.Load(equipped[i]));
			//instance.rectTransform.anchoredPosition = new Vector2(float.Parse(values[0]), float.Parse(values[1]));
			instance.name = equipped [i];
			//instance.GetComponent<DragAndDrop> ().inventory = inv;
			instance.transform.position = new Vector2(float.Parse(values[0]), float.Parse(values[1]));
		}
	}
}
