public void setHealth(float healthMultiplier) { //set up health bar and hide it initialy healthBar = GetComponentInChildren <enemyHealthBar>(); hp = baseHp * healthMultiplier; healthBar.setMax(hp); healthBar.setValue(hp); healthBar.hide(); }
// Start is called before the first frame update void Start() { target = PlayerManager.Instance.player.transform; core = target.GetComponent <CorePlayer>(); agent = GetComponent <NavMeshAgent>(); anim = GetComponentInChildren <Animator>(); agent.speed = speed; hp = hpMax; healthBar = GetComponentInChildren <enemyHealthBar>(); }