So I have a playerController and hudController. Within the hudController I have a health system with a field called “currentHealth”
within the playerController I have the following code:
hudController playersHealth;
void Start()
{
playersHealth = GetComponent<hudController>();
}
void stateManagement()
{
if (playersHealth.currentHealth == 0)
{
state = State.Dying;
playAnim.SetTrigger("isDead");
Invoke("ReloadLevel", 2f);
}
}
Am I missing something obvious here? as far as I can tell this should be working…