using UnityEngine;
using System.Collections;

public class HUD : MonoBehaviour {

	public GUITexture hp_bar;
	public GUIText score;

	public Base baza;

	float orgin_scale_x;
	Vector3 orgin_loc;

	void Start () {
		orgin_scale_x = hp_bar.transform.localScale.x;
		orgin_loc = hp_bar.transform.localPosition;
	}
	void Update () {
		if ( baza ) {
			hp_bar.transform.localScale = new Vector3(orgin_scale_x*((float)baza.hp/(float)baza.hp_max),
			                                          hp_bar.transform.localScale.y,
			                                          hp_bar.transform.localScale.z);
			hp_bar.transform.localPosition = orgin_loc;
		}
	}
}
