private void LocateAndLinkPlayer() { var p = FindObjectOfType <PlayerController>(); player = p.GetComponent <Unit>(); healthBar.Link(player.healthPoints); }
private void FindAndLinkBoss() { ResetState(); linkRef = GameObject.FindGameObjectWithTag("Boss")?.GetComponent <Unit>(); if (linkRef != null) { hpBar.Link(linkRef.healthPoints); txtName.text = linkRef.data.name; txtDamageTaken.text = ""; c.enabled = true; linkRef.healthPoints.OnChanged += ChangeListener; } }