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

public class GameUI : MonoBehaviour
{


	public TextMeshPro timeLabel;
	public Image timeSlider;

	//public GuiProgressBar comfortBar;
	public GuiProgressBar foodBar;
	public GuiProgressBar drinkBar;

	public Color progressColorNormal;
	public Color progressColorWarning;

	public static GameUI instance;

	// Use this for initialization
	void Start ()
	{
		instance = this;
	}
	
	// Update is called once per frame
	void FixedUpdate ()
	{
		SetProgressBars();
	}


	/// <summary>
	/// Only visuals in UI
	/// </summary>
	void SetProgressBars()
	{
		//comfortBar.progress.fillAmount = 1 - GlobalTime.comfortModifier;
		//comfortBar.progress.color = GlobalTime.comfortModifier > 0.5 ? progressColorWarning : progressColorNormal;

		foodBar.progress.fillAmount = 1 - GlobalTime.foodModifier;
		foodBar.progress.color = GlobalTime.foodModifier > 0.5 ? progressColorWarning : progressColorNormal;

		drinkBar.progress.fillAmount = 1 - GlobalTime.drinkModifier;
		drinkBar.progress.color = GlobalTime.drinkModifier > 0.5 ? progressColorWarning : progressColorNormal;



		timeLabel.text = Mathf.Ceil(GlobalTime.time).ToString();
		timeSlider.fillAmount = GlobalTime.time - Mathf.Floor(GlobalTime.time);
	}
}

[Serializable]
public class GuiProgressBar
{
	public Image progress;
	public Image warningIcon;
}
