Beispiel #1
0
    public void TakeDamage()
    {
        busy = true;
        currentCombatState = (int)CombatState.HIT;
        hp--;
        Instantiate(GameAssets.i.particles[10], gameObject.transform.position, gameObject.transform.rotation);
        Vector3 direction = (myPlayer.transform.position - transform.position).normalized;

        myRb.velocity = new Vector3(-direction.x * 10, 3, -direction.z * 10);
        if (hp <= 1)
        {
            hp = 0;
            StartCoroutine(Die());
        }
        myHudRenderer.SetBossHudHealth(hp);
    }
Beispiel #2
0
 private void TakeDamage()
 {
     if (!shield)
     {
         busy = true;
         SoundManager.PlaySound(SoundManager.Sound.PUNCHHITS, 0.4f);
         currentCombatState = (int)CombatState.HIT;
         hp--;
         Instantiate(GameAssets.i.particles[10], gameObject.transform.position, gameObject.transform.rotation);
         if (hp <= 0)
         {
             StartCoroutine(Die());
         }
         myHudRenderer.SetBossHudHealth(hp);
         Vector3 direction = (myPlayer.transform.position - transform.position).normalized;
         myRb.velocity = new Vector3(-direction.x * 10, 3, -direction.z * 10);
         busy          = false;
     }
 }