Esempio n. 1
0
 protected void GetHit(bool isRight, float damage, bool doKnockback)
 {
     if (state == State.Dead)
     {
         return;
     }
     health -= damage;
     if (health <= 0)
     {
         if (state != State.Dead)
         {
             SetDead(isRight, this.GetType());
         }
         target.GetComponent <Player>().AddEnemyKilledToCount(this.GetType());
     }
     else
     {
         if (!doKnockback)
         {
             SetStaggered(isRight);
         }
         else
         {
             SetKnockedBack(isRight);
         }
     }
     soundManager.PlayOneShot(getHitSound);
     cameraController.Shake(damage);
     ParticleEffectManager.PlayEffect(ParticleEffect.Type.blood, coll.bounds.center, isRight ? Vector3.left : Vector3.right);
 }
Esempio n. 2
0
 /// <summary>
 /// Hits the player
 /// </summary>
 /// <param name="damage">the amount of damage to deal</param>
 /// <param name="knockBackDirection">set to 1 if attack came from right of PC, -1 if from left, leave 0 if no knockback</param>
 public void GetHit(float damage, int knockBackDirection = 0, bool dealRawDamage = false)
 {
     if (!dealRawDamage)
     {
         float damageReduction = 1 - (0.052f * Armor) / (0.9f + 0.048f * Armor);
         health -= damage * damageReduction;
     }
     else
     {
         health -= damage;
     }
     if (knockBackDirection == 2)
     {
         playerMovement.KnockbackUp(damage);
     }
     else if (knockBackDirection != 0)
     {
         playerMovement.KnockBack(knockBackDirection == 1, damage);
     }
     if (health <= 0)
     {
         Die();
     }
     statusGUI.UpdateHealthbar();
     soundController.PlayGetHitSound();
     cameraController.Shake(damage);
     ParticleEffectManager.PlayEffect(ParticleEffect.Type.blood, playerMovement.capsColl.bounds.center, knockBackDirection == 1 ? Vector3.left : knockBackDirection == -1 ? Vector3.right : Vector3.zero);
 }
Esempio n. 3
0
    protected void GetHit(bool isRight, float damage, bool doKnockback)
    {
        if (state == State.Dead)
        {
            return;
        }
        health -= damage;
        if (health <= 0)
        {
            SetDead(isRight, this.GetType());
            StopAllCoroutines();
            animator.SetBool("Shout", false);
            animator.SetBool("Charging", false);
            animator.SetBool("Stunned", false);
            soundManager.StopPlayingBossMusic();
            bossHealthbar.Hide();
            bossArena.OpenGate1();
            bossArena.OpenGate2();

            Player p = target.GetComponent <Player>();
            p.hubSaveState.UnlockHubPortal(2);
            p.hubSaveState.UnlockHubPortal(3);
            p.hubSaveState.UnlockHubSmithNpc();
            p.hubSaveState.UnlockEssenceCollector();
            p.AddEnemyKilledToCount(this.GetType());
            FindObjectOfType <GameManager>().SaveGame(true);
        }
        else
        {
            bool stagger = false;
            if (doKnockback || staggerCounter + 1 <= maxStaggerCount)
            {
                stagger = true;
            }

            if (stagger)
            {
                staggerCounter += 1;
                SetStaggered(isRight);
            }
            else if (staggerCounter + 1 >= maxStaggerCount)
            {
                ShoutAttack();
            }
        }
        bossHealthbar.UpdateHealthbar(health, maxHealth);
        sound.PlayOneShot(getHitSound);
        cameraController.Shake(damage);
        ParticleEffectManager.PlayEffect(ParticleEffect.Type.blood, coll.bounds.center, isRight ? Vector3.left : Vector3.right);
    }
Esempio n. 4
0
    protected void GetHit(bool isRight, float damage)
    {
        if (state == State.Dead)
        {
            return;
        }
        health -= damage;
        if (health <= 0)
        {
            StopAllCoroutines();
            nagaManager.EnrageFemaleNaga();
            SetDead(isRight, this.GetType(), 0);
            nagaManager.Died(false);
            animator.SetBool("IsChannellingWhirlwind", false);
            animator.SetBool("IsWindingUpWhirlwind", false);
            this.enabled = false;
            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);
 }
Esempio n. 6
0
    protected void GetHit(bool isRight, float damage)
    {
        if (state == State.Dead)
        {
            return;
        }
        health -= damage;
        if (health <= 0)
        {
            StopAllCoroutines();
            nagaManager.EnrageMaleNaga();
            SetDead(isRight, this.GetType(), 0);
            nagaManager.Died(true);
            nagaManager.HideHealthbar(true);
            this.enabled = false;
            target.GetComponent <Player>().AddEnemyKilledToCount(this.GetType());
        }
        else
        {
            bool stagger = false;
            if (staggerCounter + 1 <= maxStaggerCount)
            {
                stagger = true;
            }

            if (stagger)
            {
                staggerCounter += 1;
                SetStaggered(isRight);
            }
            nagaManager.UpdateHealthbar(true, health, maxHealth);
        }
        sound.PlayOneShot(getHitSound);
        cameraController.Shake(damage);
        ParticleEffectManager.PlayEffect(ParticleEffect.Type.blood, coll.bounds.center, isRight ? Vector3.left : Vector3.right);
    }