public override void Start() { base.Start(); visual.GetComponent <Collider> ().enabled = true; hpBar = Instantiate(HpBarPrefab, visual.transform).GetComponent <HpBar> (); hpBar.transform.localPosition = new Vector3(0, 1.7f, 0); hpBar.UpdateHPBar(currentHP, MaxHP); }
public virtual void TakeDamage(float damage) { health -= damage; if (health <= 0) { Die(); } hpBar.UpdateHPBar(health, maxHealth); }
// Use this for initialization public virtual void Start() { GetNavAgent(); //startPosition = startPositionObj.transform.position; speed = agent.speed; health = 100; damage = 50; maxHealth = health; hpBar = Instantiate(HpBarPrefab, transform).GetComponent <HpBar> (); hpBar.transform.localPosition = new Vector3(0, 1.7f, 0); hpBar.UpdateHPBar(health, maxHealth); }
public override void TakeDamage(float amount) { base.TakeDamage(amount); hpBar.UpdateHPBar(currentHP, MaxHP); }