Skip to content
Snippets Groups Projects
Forked from Chirz / CityEscape
293 commits behind the upstream repository.
PlayerNature.cs 629 B
/*
 *      Script par Tanguy Gimenez      
 *
 */

using UnityEngine;

public class PlayerNature : MonoBehaviour
{
    public int maxNature = 200;
    public int currentNature;
    public Bar natureBar;

    void Start()
    {
        this.currentNature = this.maxNature/2;

        this.natureBar.SetMaxNature(this.maxNature);
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
            this.LooseNature(1);
    }

    public void LooseNature(int damage)
    {
        this.currentNature -= damage;

        this.natureBar.SetValue(this.currentNature);
    }
}