예제 #1
0
    void FixedUpdate()
    {
        if (GameController.Instance.playerDead)
        {
            anim.SetInteger("State", 0);
            anim.SetInteger("HeadState", 0);

            if (rb != null)
            {
                StopMoving();
            }
        }
        else

        if (!died)
        {
            SetDirection();
            SetTimer();
            SetAnimation();
            HeadAnimations();
            SetIsAttacking();

            speed *= speedBoost;

            if (anim.GetCurrentAnimatorStateInfo(0).IsName("Shock1"))
            {
                rb.velocity = new Vector2(Utility.EnemyDirection(this.transform, player.transform) * blowSpeed, rb.velocity.y);
            }
            else if (speed != 0)
            {
                MoveHorizontal(speed);
            }
            else
            {
                StopMoving();
            }

            if (lbp.GetEnemyShieldHealth() <= 0)
            {
                anim.SetLayerWeight(anim.GetLayerIndex("Layer1"), 0f);
            }

            if ((anim.GetCurrentAnimatorStateInfo(0).IsName("QuickAttack1") || anim.GetCurrentAnimatorStateInfo(0).IsName("StrongAttack1")) &&
                Mathf.Abs(Utility.GetDistanceBetween(this.transform, player.transform)) > distance - 2f)
            {
                this.rb.velocity = new Vector2(Utility.EnemyDirection(player.transform, this.transform) * 2f, rb.velocity.y);
            }

            if (Mathf.Abs(Utility.GetDistanceBetween(transform, player.transform)) < distance * 0.75f && !isAttacking)
            {
                rb.velocity = new Vector2(-Utility.EnemyDirection(player.transform, this.transform) * 8f, rb.velocity.y);
                anim.SetInteger("State", 1);
                anim.SetFloat("Speed", -1);
            }
        }
        else
        {
            if (checkAllDied)
            {
                if (GameController.Instance.atBossRoom)
                {
                    if (!GameController.Instance.gameFinished)
                    {
                        if (GameController.Instance.current_level == GameController.Instance.player_level)
                        {
                            GameController.Instance.levelPassed  = true;
                            GameController.Instance.castlePassed = true;
                            GameController.Instance.player_level++;
                        }
                    }

                    player.transform.parent.GetComponent <PlayerMobileCtrl>().FadeinInTime(5f);
                    GameController.Instance.player_total_money += GameController.Instance.tempMoney;
                    GameController.Instance.skillpoints_left   += 12;
                    GameController.Instance.tempMoney           = 0;
                }

                checkAllDied = false;
            }

            Destroy(GetComponent <Rigidbody2D>());
            RemoveCollidersRecursively();
            anim.SetInteger("State", 10);
            anim.SetInteger("HeadState", 3);

            if ((transform.position - player.transform.position).magnitude > 30f)
            {
                Destroy(gameObject);
            }
        }
    }
예제 #2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // for infantry
        if (other.gameObject.CompareTag("EnemiesBody"))
        {
            eh = other.transform.parent.gameObject.GetComponent <EnemyHealth>();
            ic = other.transform.parent.gameObject.GetComponent <InfantryController>();

            if ((ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("QuickAttack") ||
                 ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("JumpAttack")) &&
                !ic.GetDefenseStatus())
            {
                ic.SetIsAttacked(true);

                if (eh.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(stab0, stab1, stab2, stab3);
                    eh.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }

            if ((ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("WalkingAttack") ||
                 ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("StrongAttack")) &&
                !ic.GetDefenseStatus())
            {
                ic.SetIsAttacked(true);

                if (eh.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(swing0, swing1, swing2);
                    eh.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }
        }


        if (other.gameObject.CompareTag("EnemyShield"))
        {
            ic = other.transform.parent.parent.parent.parent.parent.GetComponent <InfantryController>();
            eh = other.transform.parent.parent.parent.parent.parent.gameObject.GetComponent <EnemyHealth>();

            if (ic.GetDefenseStatus())
            {
                if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("QuickAttack") ||
                    ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("JumpAttack") ||
                    ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("WalkingAttack") ||
                    ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("StrongAttack"))
                {
                    if (eh.GetEnemyShieldHealth() > 0 && !damaged_shield)
                    {
                        CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsSmall);

                        eh.ReceiveShieldDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                        damaged_shield = true;

                        if (other.transform.parent.parent.parent.parent.parent.GetComponent <EnemyArmour>().GetShield() > 2)
                        {
                            has.RandomizeSfxShieldIron(shieldhit_iron_0, shieldhit_iron_1, shieldhit_iron_2);
                        }
                        else
                        {
                            has.RandomizeSfxShieldWood(shieldhit_wood_0, shieldhit_wood_1, shieldhit_wood_2);
                        }


                        if (GameController.Instance.hotParticles)
                        {
                            HotParticlesForShield(other.transform);
                        }
                        else
                        {
                            DestroyParticles(other.transform);
                        }
                    }
                }
            }
        }


        // for archer

        if (other.gameObject.CompareTag("ArcherBody"))
        {
            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("WalkingAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("StrongAttack"))
            {
                ah = other.transform.parent.gameObject.GetComponent <ArcherHealth>();
                ac = other.transform.parent.gameObject.GetComponent <ArcherController>();
                ac.SetIsAttacked(true);

                if (ah.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(swing0, swing1, swing2);
                    ah.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }

            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("QuickAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("JumpAttack"))
            {
                ah = other.transform.parent.gameObject.GetComponent <ArcherHealth>();
                ac = other.transform.parent.gameObject.GetComponent <ArcherController>();
                ac.SetIsAttacked(true);

                if (ah.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(stab0, stab1, stab2, stab3);
                    ah.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }
        }

        // For Cursed

        if (other.gameObject.CompareTag("CursedBody"))
        {
            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("WalkingAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("StrongAttack"))
            {
                cp = other.transform.parent.gameObject.GetComponent <CursedPower>();
                cc = other.transform.parent.gameObject.GetComponent <CursedController>();

                cc.SetIsAttacked(true);

                if (cp.GetTotalHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfxShieldWood(shieldhit_wood_0, shieldhit_wood_1, shieldhit_wood_2);
                    cp.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;

                    DestroyParticles(other.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }

            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("QuickAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("JumpAttack"))
            {
                cp = other.transform.parent.gameObject.GetComponent <CursedPower>();
                cc = other.transform.parent.gameObject.GetComponent <CursedController>();

                cc.SetIsAttacked(true);

                if (cp.GetTotalHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfxShieldWood(shieldhit_wood_0, shieldhit_wood_1, shieldhit_wood_2);
                    cp.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;

                    DestroyParticles(other.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }
        }
        // For CursedBoss

        if (other.gameObject.CompareTag("CursedBossBody"))
        {
            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("WalkingAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("StrongAttack"))
            {
                cbp = other.transform.parent.gameObject.GetComponent <CursedBossPower>();
                cbc = other.transform.parent.gameObject.GetComponent <CursedBossCtrl>();

                cbc.SetIsAttacked(true);

                if (cbp.GetTotalHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfxShieldWood(shieldhit_wood_0, shieldhit_wood_1, shieldhit_wood_2);
                    cbp.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;

                    DestroyParticles(other.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }

            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("QuickAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("JumpAttack"))
            {
                cbp = other.transform.parent.gameObject.GetComponent <CursedBossPower>();
                cbc = other.transform.parent.gameObject.GetComponent <CursedBossCtrl>();

                cbc.SetIsAttacked(true);

                if (cbp.GetTotalHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfxShieldWood(shieldhit_wood_0, shieldhit_wood_1, shieldhit_wood_2);
                    cbp.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;

                    DestroyParticles(other.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }
        }

        // For Brigand

        if (other.gameObject.CompareTag("BrigandBody"))
        {
            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("WalkingAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("StrongAttack"))
            {
                bh = other.transform.parent.gameObject.GetComponent <BrigandHealth>();
                bc = other.transform.parent.gameObject.GetComponent <BrigandController>();

                bc.SetIsAttacked(true);

                if (bh.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(swing0, swing1, swing2);
                    bh.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }

            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("QuickAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("JumpAttack"))
            {
                bh = other.transform.parent.gameObject.GetComponent <BrigandHealth>();
                bc = other.transform.parent.gameObject.GetComponent <BrigandController>();

                bc.SetIsAttacked(true);

                if (bh.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(stab0, stab1, stab2, stab3);
                    bh.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }
        }

        // For Spearman

        if (other.gameObject.CompareTag("SpearmanBody"))
        {
            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("WalkingAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("StrongAttack"))
            {
                sh = other.transform.parent.gameObject.GetComponent <SpearmanHealth>();
                sc = other.transform.parent.gameObject.GetComponent <SpearmanController>();

                sc.SetIsAttacked(true);

                if (sh.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(swing0, swing1, swing2);
                    sh.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }

            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("QuickAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("JumpAttack"))
            {
                sh = other.transform.parent.gameObject.GetComponent <SpearmanHealth>();
                sc = other.transform.parent.gameObject.GetComponent <SpearmanController>();

                sc.SetIsAttacked(true);

                if (sh.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(stab0, stab1, stab2, stab3);
                    sh.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }
        }

        // Cyclops

        if (other.gameObject.CompareTag("CyclopsBody"))
        {
            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("WalkingAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("StrongAttack"))
            {
                coh = other.transform.parent.gameObject.GetComponent <CyclopsHealth>();
                coc = other.transform.parent.gameObject.GetComponent <CyclopsController>();

                coc.SetIsAttacked(true);

                if (coh.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(swing0, swing1, swing2);
                    coh.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }

            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("QuickAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("JumpAttack"))
            {
                coh = other.transform.parent.gameObject.GetComponent <CyclopsHealth>();
                coc = other.transform.parent.gameObject.GetComponent <CyclopsController>();

                coc.SetIsAttacked(true);

                if (coh.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(stab0, stab1, stab2, stab3);
                    coh.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }
        }

        // HeavyHead

        if (other.gameObject.CompareTag("HeavyHeadBody"))
        {
            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("WalkingAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("StrongAttack"))
            {
                hhh = other.transform.parent.parent.gameObject.GetComponent <HeavyHeadHealth>();
                hhc = other.transform.parent.parent.gameObject.GetComponent <HeavyHeadController>();

                hhc.SetIsAttacked(true);

                if (hhh.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(swing0, swing1, swing2);
                    hhh.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }

            if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("QuickAttack") ||
                ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("JumpAttack"))
            {
                hhh = other.transform.parent.parent.gameObject.GetComponent <HeavyHeadHealth>();
                hhc = other.transform.parent.parent.gameObject.GetComponent <HeavyHeadController>();

                hhc.SetIsAttacked(true);

                if (hhh.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(stab0, stab1, stab2, stab3);
                    hhh.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }
        }

        // Last Boss

        if (other.gameObject.CompareTag("BossBody"))
        {
            lbp = other.transform.parent.gameObject.GetComponent <LastBossPower>();
            lbc = other.transform.parent.gameObject.GetComponent <LastBossCtrl>();

            if ((ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("QuickAttack") ||
                 ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("JumpAttack")) &&
                !lbc.GetDefenseStatus())
            {
                lbc.SetIsAttacked(true);

                if (lbp.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(stab0, stab1, stab2, stab3);
                    lbp.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }

            if ((ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("WalkingAttack") ||
                 ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("StrongAttack")) &&
                !lbc.GetDefenseStatus())
            {
                lbc.SetIsAttacked(true);

                if (lbp.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(swing0, swing1, swing2);
                    lbp.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }
        }


        if (other.gameObject.CompareTag("BossShield"))
        {
            lbc = other.transform.parent.parent.parent.parent.parent.GetComponent <LastBossCtrl>();
            lbp = other.transform.parent.parent.parent.parent.parent.gameObject.GetComponent <LastBossPower>();

            if (lbc.GetDefenseStatus())
            {
                if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("QuickAttack") ||
                    ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("JumpAttack") ||
                    ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("WalkingAttack") ||
                    ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("StrongAttack"))
                {
                    if (lbp.GetEnemyShieldHealth() > 0 && !damaged_shield)
                    {
                        CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsSmall);

                        lbp.ReceiveShieldDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                        damaged_shield = true;

                        has.RandomizeSfxShieldIron(shieldhit_iron_0, shieldhit_iron_1, shieldhit_iron_2);

                        if (GameController.Instance.hotParticles)
                        {
                            HotParticlesForShield(other.transform);
                        }
                        else
                        {
                            DestroyParticles(other.transform);
                        }
                    }
                }
            }
        }

        //  For SpearBoss

        if (other.gameObject.CompareTag("SpearBossBody"))
        {
            sbp = other.transform.parent.gameObject.GetComponent <SpearBossPower>();
            sbc = other.transform.parent.gameObject.GetComponent <SpearBossCtrl>();

            if ((ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("QuickAttack") ||
                 ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("JumpAttack")) &&
                !sbc.GetDefenseStatus())
            {
                sbc.SetIsAttacked(true);

                if (sbp.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(stab0, stab1, stab2, stab3);
                    sbp.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }

            if ((ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("WalkingAttack") ||
                 ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("StrongAttack")) &&
                !sbc.GetDefenseStatus())
            {
                sbc.SetIsAttacked(true);

                if (sbp.GetEnemyHealth() > 0 && !damaged)
                {
                    CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsBig);
                    has.RandomizeSfx(swing0, swing1, swing2);
                    sbp.ReceiveDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                    damaged = true;
                    BloodEffect(other.transform.parent.transform);

                    if (GameController.Instance.hotParticles)
                    {
                        HotParticles(other.transform.parent.transform);
                    }
                }
            }
        }


        if (other.gameObject.CompareTag("SpearBossShield"))
        {
            sbc = other.transform.parent.parent.parent.parent.parent.GetComponent <SpearBossCtrl>();
            sbp = other.transform.parent.parent.parent.parent.parent.gameObject.GetComponent <SpearBossPower>();

            if (sbc.GetDefenseStatus())
            {
                if (ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("QuickAttack") ||
                    ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("JumpAttack") ||
                    ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("WalkingAttack") ||
                    ps.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("StrongAttack"))
                {
                    if (sbp.GetEnemyShieldHealth() > 0 && !damaged_shield)
                    {
                        CameraShaker.Instance.ShakeOnce(GameController.Instance.magnitudeValsSmall);

                        sbp.ReceiveShieldDamage(Utility.GetWeaponDamageAmountPlayer(pState.GetWeaponCategoryAndIndex(), GameController.Instance.player_power, GameController.Instance.player_sharpening, GameController.Instance.player_weaponEmber));
                        damaged_shield = true;

                        has.RandomizeSfxShieldIron(shieldhit_iron_0, shieldhit_iron_1, shieldhit_iron_2);

                        if (GameController.Instance.hotParticles)
                        {
                            HotParticlesForShield(other.transform);
                        }
                        else
                        {
                            DestroyParticles(other.transform);
                        }
                    }
                }
            }
        }


        ///////
    }