Exemple #1
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);
    }
    public void Died(bool isNagaQueen)
    {
        if (isNagaQueen)
        {
            isNagaQueenDead = true;
        }
        else
        {
            isNagaKingDead = true;
        }

        if (isNagaKingDead && isNagaQueenDead)
        {
            bossArena.OpenGate1();
            bossArena.OpenGate2();
        }
    }