예제 #1
0
    protected void GetHit(bool isRight, float damage)
    {
        if (state == State.Dead)
        {
            return;
        }
        health -= damage;
        if (health <= 0)
        {
            StopAllCoroutines();
            SetDead(isRight, this.GetType());
            nagaManager.Died(false);
            animator.SetBool("IsChannellingWhirlwind", false);
            animator.SetBool("IsWindingUpWhirlwind", false);
            nagaManager.StopPlayingBossMusic();
            nagaManager.HideHealthbar(false);
            if (spawnedWhirlwindObject != null)
            {
                spawnedWhirlwindObject.GetComponent <NagaKingWhirlwindEffect>().Stop();
            }
            target.GetComponent <Player>().AddEnemyKilledToCount(this.GetType());
        }
        else
        {
            bool stagger = false;
            if (staggerCounter + 1 <= maxStaggerCount)
            {
                stagger = true;
            }

            if (stagger)
            {
                staggerCounter += 1;
                SetStaggered(isRight);
            }
            nagaManager.UpdateHealthbar(false, health, maxHealth);
        }
        sound.PlayOneShot(getHitSound);
        cameraController.Shake(damage);
        ParticleEffectManager.PlayEffect(ParticleEffect.Type.blood, coll.bounds.center, isRight ? Vector3.left : Vector3.right);
    }
 protected void GetHit(bool isRight, float damage)
 {
     if (state == State.Dead || !canTakeDamage)
     {
         return;
     }
     health -= damage;
     if (health <= 0)
     {
         StopAllCoroutines();
         SetDead(isRight, this.GetType());
         nagaManager.Died(true);
         nagaManager.StopPlayingBossMusic();
         nagaManager.HideHealthbar(true);
         target.GetComponent <Player>().AddEnemyKilledToCount(this.GetType());
     }
     Teleport();
     nagaManager.UpdateHealthbar(true, health, maxHealth);
     sound.PlayOneShot(getHitSound);
     cameraController.Shake(damage);
     ParticleEffectManager.PlayEffect(ParticleEffect.Type.blood, coll.bounds.center, isRight ? Vector3.left : Vector3.right);
 }