Exemple #1
0
 public void Fire(Vector3 position, Vector3 direction)
 {
     transform.position = position;
     transform.forward  = direction;
     gameObject.layer   = LayerMask.NameToLayer("EnemyProjectile");
     gameObject.SetActive(true);
     rb.isKinematic = false;
     rb.velocity    = Vector3.zero;
     rb.AddForce(direction * 80, ForceMode.Impulse);
     hit = maxHit;
     healthBar.UpdateHealth(hit, maxHit);
     attacking = true;
 }
Exemple #2
0
    public void TakeDamage(int damage)
    {
        health -= damage;

        if (health <= 0)
        {
            OnDeath();
        }

        healthBar.UpdateHealth(health, maxHealth);
    }