using UnityEngine;
using System.Collections;

public class progressbar : MonoBehaviour {
	public GameObject dependent;
	Vector3 thisscale;
	public Texture[] texarray = new Texture[4];
	// Use this for initialization
	void Start () {
		thisscale = new Vector3 (0.1f,30f,1f);
	}
	
	// Update is called once per frame
	void Update () {
		if (dependent.GetComponent<core> ().stage == 1)
			renderer.material.mainTexture = texarray [0];

		if(dependent.GetComponent<core>().stage == 2)
			renderer.material.mainTexture = texarray [1];

		if(dependent.GetComponent<core>().stage == 3)
			renderer.material.mainTexture = texarray [2];

		if(dependent.GetComponent<core>().stage == 4)
			renderer.material.mainTexture = texarray [3];


		thisscale.x = dependent.GetComponent<core>().barratio * 62f;

		if (thisscale.x >= 62f)
						thisscale.x = 2f;
		transform.localScale = thisscale;


	}
}
