diff --git a/Assets/Scripts/Entity.cs b/Assets/Scripts/Entity.cs index c2cfe15..cae8daa 100644 --- a/Assets/Scripts/Entity.cs +++ b/Assets/Scripts/Entity.cs @@ -4,9 +4,14 @@ using UnityEngine; public class Entity : MonoBehaviour { - public float hpMax; + [BeforeStartAttribute] + public float hpTrueMax; + public bool overlappable = false; + [AfterStartAttribute] + public float hpMax; + [AfterStartAttribute] public float hp; @@ -30,6 +35,7 @@ public class Entity : MonoBehaviour map = gameController.GetComponentInChildren(); GameObject canvas = GameObject.FindGameObjectWithTag("Canvas"); messageBar = canvas.GetComponentInChildren(); + hpMax = hpTrueMax; hp = hpMax; } diff --git a/Assets/Scripts/FillAmountFromPlayerHP.cs b/Assets/Scripts/FillAmountFromPlayerHP.cs index be01f33..4c7fe47 100644 --- a/Assets/Scripts/FillAmountFromPlayerHP.cs +++ b/Assets/Scripts/FillAmountFromPlayerHP.cs @@ -7,6 +7,7 @@ public class FillAmountFromPlayerHP : MonoBehaviour { private EntityPlayer player; private Image image; + public bool max; private void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent(); @@ -14,6 +15,11 @@ public class FillAmountFromPlayerHP : MonoBehaviour } private void Update() { - image.fillAmount = player.hp / player.hpMax; + if(max) { + image.fillAmount = player.hpMax / player.hpTrueMax; + } + else { + image.fillAmount = player.hp / player.hpTrueMax; + } } }