Health stuff
This commit is contained in:
@@ -12,24 +12,15 @@ public class PlayerMovement : MonoBehaviour
|
||||
private CharacterController controller;
|
||||
private Vector3 velocity;
|
||||
private PlayerSkillTree PlayerSkills;
|
||||
private int health;
|
||||
private int maxHealth;
|
||||
[Header ("Health")]
|
||||
[SerializeField] private TMP_Text healthBar;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
PlayerSkills = PlayerSkillTree.Instance;
|
||||
maxHealth = PlayerSkills.MaxHealth;
|
||||
health = PlayerSkills.GetHealth();
|
||||
|
||||
Debug.Assert(maxHealth > 0);
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
controller = GetComponent<CharacterController>();
|
||||
healthBar.text = GetHealthText();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -50,17 +41,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
Debug.Log("Potion not available!");
|
||||
}
|
||||
}
|
||||
|
||||
// TEMPORARY!!! LATER USED FOR COLISIONS
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.F))
|
||||
{
|
||||
PlayerSkills.SetHealth(-20);
|
||||
health = PlayerSkills.GetHealth();
|
||||
|
||||
healthBar.text = GetHealthText();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FixedUpdate()
|
||||
@@ -116,9 +96,4 @@ public class PlayerMovement : MonoBehaviour
|
||||
{
|
||||
return PlayerSkills.GetPlayerSkills();
|
||||
}
|
||||
|
||||
private string GetHealthText()
|
||||
{
|
||||
return (health.ToString() + " / " + maxHealth.ToString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user