diff options
author | marcinzelent <marcin@zelent.net> | 2020-02-01 17:06:41 +0100 |
---|---|---|
committer | marcinzelent <marcin@zelent.net> | 2020-02-01 17:06:41 +0100 |
commit | a8fe54592f727ddad05040b82ccb490218682d7c (patch) | |
tree | 324d5be7c1e61a5f19daaf526147d69c6763f47e /nGJ2019/Assets/Scripts/HealthBar.cs | |
parent | 98bb688bd7c709eca3e97c5e9d58415d7df65db3 (diff) |
Renamed to Dragon Dust
Diffstat (limited to 'nGJ2019/Assets/Scripts/HealthBar.cs')
-rw-r--r-- | nGJ2019/Assets/Scripts/HealthBar.cs | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/nGJ2019/Assets/Scripts/HealthBar.cs b/nGJ2019/Assets/Scripts/HealthBar.cs deleted file mode 100644 index 685e297..0000000 --- a/nGJ2019/Assets/Scripts/HealthBar.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class HealthBar : MonoBehaviour -{ - public GameObject crystalPrefab; - public Material liveCrystal; - public Material deadCrystal; - - public int lives; - - private int currentHealth; - public int health - { - get{return currentHealth;} - set - { - currentHealth = value; - updateCrystals(); - } - } - - private List<Renderer> crystals = new List<Renderer>(); - - private void updateCrystals() - { - for(int i=0; i<lives; i++) - { - if(health > i) - crystals[i].material = liveCrystal; - else - crystals[i].material = deadCrystal; - } - } - - void Start() - { - for(int i=0; i<lives; i++) - { - GameObject crystal = Instantiate(crystalPrefab, transform.position + Vector3.right*1.4f*i, Quaternion.identity); - crystals.Add(crystal.GetComponentInChildren<Renderer>()); - } - - health = lives; - updateCrystals(); - } - - // Update is called once per frame - void Update() - { - - } -} |