using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class SignesVitaux : MonoBehaviour
{
public Slider sliderVie;
public int maxVie;
public float perteVie;
public Slider sliderFaim;
public int maxFaim;
public float perteFaim;
public Slider sliderSoif;
public int maxSoif;
public float perteSoif;
void Start()
{
sliderVie.maxValue = maxVie;
sliderVie.value = maxVie;
sliderFaim.maxValue = maxFaim;
sliderFaim.value = maxFaim;
sliderSoif.maxValue = maxSoif;
sliderSoif.value = maxSoif;
}
void Update()
{
if (sliderFaim.value <= 0 && (sliderSoif.value <= 0))
{
sliderVie.value -= Time.deltaTime / perteVie * 2;
}
else if (sliderSoif.value <= 0 || sliderFaim.value <= 0)
{
sliderVie.value -= Time.deltaTime / perteVie;
}
if (sliderVie.value <= 0)
{
mortJoueur();
}
if (sliderFaim.value >= 0)
{
sliderFaim.value -= Time.deltaTime / perteFaim;
}
else if (sliderFaim.value <= 0)
{
sliderFaim.value = 0;
}
else if (sliderFaim.value >= maxFaim)
{
sliderFaim.value = maxFaim;
}
if (sliderSoif.value >= 0)
{
sliderSoif.value -= Time.deltaTime / perteSoif;
}
else if (sliderSoif.value <= 0)
{
sliderSoif.value = 0;
}
else if (sliderSoif.value >= maxSoif)
{
sliderSoif.value = maxSoif;
}
}
void mortJoueur()
{
}
}