Human-Farm-Tycoon/Assets/Script/HungerScript.cs
Michael Turcotte be73c8fdc8 Added a test to my scene where we can end a turn and see the hunger being affected.
Added some functions to the Stats script.
Added the HungerScript to manage the hunger bars.
2015-08-13 17:40:12 -04:00

29 lines
834 B
C#

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class HungerScript : MonoBehaviour {
public Slider sliderZombie;
public Slider sliderHumans;
private Stats stats;
// Use this for initialization
void Start()
{
stats = GameObject.Find("Stats").gameObject.GetComponent<Stats>();
sliderHumans.maxValue = stats.MaxHungerHuman;
sliderZombie.maxValue = stats.MaxHungerZombies;
sliderHumans.value = sliderHumans.maxValue;
sliderZombie.value = sliderZombie.maxValue;
}
// Update is called once per frame
void Update () {
sliderHumans.maxValue = stats.MaxHungerHuman;
sliderZombie.maxValue = stats.MaxHungerZombies;
sliderHumans.value = stats.AmountOfHHunger;
sliderZombie.value = stats.AmountOfZHunger;
}
}