private void DamagePlayer(Collider collider) { PlayerHealthBehaviour player = collider.GetComponent <PlayerHealthBehaviour>(); if (player) { player.TakeDamage(1); } }
public bool ApplyPowerUp(GameObject obj) { // Attempt to get a PlayerHealthBehaviour from obj PlayerHealthBehaviour health = obj.GetComponentInParent <PlayerHealthBehaviour>(); // If we were successful, regen health and return true if (health) { health.RegenHealth(_amountToHeal); return(true); } else { return(false); } }
private void Awake() { playerHealthBehaviour = GetComponent <PlayerHealthBehaviour>(); lifebarManager = FindObjectOfType <LifebarManager>(); }
private void Awake() { _health = FindObjectOfType <PlayerHealthBehaviour>(); _health.OnHealthChanged += AdjustSize; _initialSize = transform.localScale.x; }