Newer
Older
/*
* Script par Tanguy Gimenez
*
*/
using UnityEngine;
public class PlayerNature : MonoBehaviour
{
// l'instance de PlayerNature (pour un singleton)
public static PlayerNature instance;
// Nombre max de points de nature que le joueur peut avoir (objectif à atteindre)
public int maxNature = 200;
this.natureBar.SetMaxNature(this.maxNature);
}
if (Input.GetKeyDown(KeyCode.Space))
this.LooseNature(1);
}

v.bloch
committed
public void LooseNature(int damage)
{
this.currentNature -= damage;
this.natureBar.SetValue(this.currentNature);
}
// Gagne un certain nombre de points de nature
public void WinNature(int bonus)
{
this.currentNature += bonus;
this.natureBar.SetValue(this.currentNature);
}
// Singleton
private void Awake()
{
if (instance != null)
{
Debug.LogWarning("Il y a + d'une instance de PlayerNature");
return;
}
instance = this;
}