Example #1
0
    IEnumerator BuffAndAttack()
    {
        // 공격
        attackEffect.SetActive(true);
        attackEffect.transform.SetParent(this.transform);
        attackEffect.transform.localPosition = new Vector3(0, -7f, 0);
        attackEffect.transform.localRotation = Quaternion.Euler(Vector3.zero);
        attackEffect.transform.localScale    = new Vector3(2, 2, 2);

        while (startSkill)
        {
            SoundManager.instance.PlaySFX(audioSource,
                                          "SPACE_WARP_Type_01_Warp_A_stereo");
            Collider[] colls = Physics.OverlapSphere(transform.position, checkRadius, layer);

            // 적은 어택 아군은 버프
            foreach (Collider obj in colls)
            {
                if (obj.gameObject.layer == LayerMask.NameToLayer("Enemy"))
                {
                    SkillManager.Instance.SetSkillDamage(obj, 10);
                    //Debug.LogFormat("{0} 에게 데미지를 준다!", obj.gameObject.name);
                }
                else if (obj.gameObject.layer == LayerMask.NameToLayer("Ally"))
                {
                    AIAttributte ai = obj.GetComponent <AIAttributte>();
                    ai.AddBuff("Speed UP", SkillManager.Instance.player);
                    //ai.AddBuff("", SkillManager.instance.player);
                    //Debug.LogFormat("{0} 에게 버프를 준다!", obj.gameObject.name);
                }
                else if (obj.gameObject.layer == LayerMask.NameToLayer("Player"))
                {
                    CharacterAttributes my = obj.GetComponent <CharacterAttributes>();
                    my.AddBuff("Speed UP", SkillManager.Instance.player);
                    //my.AddBuff("", SkillManager.instance.player);
                }
            }

            yield return(d_time);
        }


        attackEffect.SetActive(false);
        summonEffect.SetActive(false);

        // 폭발 파티클 추가 필요

        explosion.transform.SetParent(null);
        explosion.transform.position = point;
        explosion.SetActive(true);
        StartCoroutine(ex.switchOnOff());
        ex.start = new Vector3(point.x, point.y + ex.BoxSize.y * 0.5f, point.z);
        SoundManager.instance.PlaySFX(exAudio,
                                      "EXPLOSION_Medium_Blast_Scatter_Debris_Long_Faint_Tail_stereo");
        //Collider[] explosionColls = Physics.OverlapSphere(transform.position, checkRadius, LayerMask.GetMask("Enemy"));

        //foreach(Collider obj in explosionColls)
        //{
        //    SkillManager.instance.SetSkillDamage(obj, 30);
        //}

        this.transform.SetParent(SkillManager.Instance.transform);
        this.gameObject.SetActive(false);

        //Destroy(this.gameObject);

        yield return(null);
    }
    public void GiveDamage(AttackCommand command, E_ObjectType targetType)
    {
        switch (targetType)
        {
        case E_ObjectType.Character:
        {
            if (playerMovement && playerMovement.p_state == STATE.ROLL)
            {
                return;
            }

            command.m_Target.GetComponent <CharacterAttributes>().TakeDamage(command.m_Damage);

            if (!SkillManager.Instance.player.GetComponent <Player_Movement>().CharacterAudio.isPlaying)
            {
                SoundManager.instance.PlaySFX(SkillManager.Instance.player.GetComponent <Player_Movement>().CharacterAudio,
                                              "VOICE_Martial_Art_Shout_02_mono");
            }
        }
        break;

        case E_ObjectType.Ally:
            command.m_Target.GetComponent <AllyController>().GetDamage(command.m_Damage, command.m_Attacker);
            break;

        case E_ObjectType.Boss:
            command.m_Target.GetComponent <BossController>().GetDamage(command.m_Damage, command.m_Attacker);
            break;

        case E_ObjectType.DBoss:
            command.m_Target.GetComponent <DBossController>().GetDamage(command.m_Damage, command.m_Attacker);
            break;

        case E_ObjectType.Monster:
        {
            // 플레이어 또는 아군이 데미지를 줬을 경우 퍽에 따른 버프 적용



            Buff buffTemp  = null;
            int  addDamage = 0;

            // 플레이어
            if (command.m_Attacker.GetComponent <CharacterAttributes>() != null)
            {
                CharacterAttributes characterAttributes = command.m_Attacker.GetComponent <CharacterAttributes>();

                if (command.attackType == AttackType.MainWeapon || command.attackType == AttackType.SubWeapon)
                {
                    if (command.attackType == AttackType.MainWeapon && characterAttributes.weaponManager.m_MainWeapon == "009" /*&& characterAttributes.SearchBuff("Party Mood Maker Cooltime") == null*/)         // 파티 분위기 메이커 (스턴)
                    {
                        int stunChance = Random.Range(1, 10);

                        if (stunChance == 1)
                        {
                            command.m_Target.GetComponent <AIAttributte>().AddBuff("Stun", command.m_Attacker);

                            /*characterAttributes.AddBuff("Party Mood Maker Cooltime", characterAttributes.gameObject);*/
                        }
                    }

                    if (characterAttributes.SearchPerk(2001) != null)         // 방사능 디버프
                    {
                        command.m_Target.GetComponent <AIAttributte>().AddBuff("Radiation", command.m_Attacker);
                    }

                    if (characterAttributes.SearchPerk(2005) != null)         // 대구경탄(스턴)
                    {
                        command.m_Target.GetComponent <AIAttributte>().AddBuff("Stun", command.m_Attacker);
                    }

                    if (characterAttributes.SearchPerk(2006) != null)         // 소이탄(발화)
                    {
                        command.m_Target.GetComponent <AIAttributte>().AddBuff("Burn", command.m_Attacker);
                    }

                    // 스위치탄
                    buffTemp = characterAttributes.SearchBuff("Switch ON");
                    if (buffTemp != null)
                    {
                        addDamage += buffTemp.value[buffTemp.currentStack - 1];
                        buffTemp   = null;
                    }

                    // 위협적인 광기
                    buffTemp = characterAttributes.SearchBuff("Maniacing Madness");
                    if (buffTemp != null)
                    {
                        addDamage += buffTemp.value[buffTemp.currentStack - 1];
                        buffTemp   = null;
                    }

                    // 키클롭스 데미지 2배 장판버프
                    buffTemp = characterAttributes.SearchBuff("Damage Buff");
                    if (buffTemp != null)
                    {
                        addDamage += command.m_Damage;
                        buffTemp   = null;
                    }

                    if (addDamage != 0)
                    {
                        if (characterAttributes.SearchPerk(2003) != null)         // 쉴드 드레인
                        {
                            characterAttributes.DrainShield(command.m_Damage + addDamage);
                        }

                        if (characterAttributes.isDrainHealth)         // HP 드레인
                        {
                            characterAttributes.isDrainHealth = false;
                            characterAttributes.DrainHealth(command.m_Damage + addDamage);
                            characterAttributes.AddBuff("Drain Health Cooltime", characterAttributes.gameObject);
                        }

                        command.m_Target.GetComponent <EnemyController>().GetDamage(command.m_Damage + addDamage, command.m_Attacker, command.attackType);
                        break;
                    }
                    else
                    {
                        if (characterAttributes.SearchPerk(2003) != null)         // 쉴드 드레인
                        {
                            characterAttributes.DrainShield(command.m_Damage);
                        }

                        if (characterAttributes.isDrainHealth)         // HP 드레인
                        {
                            characterAttributes.isDrainHealth = false;
                            characterAttributes.DrainHealth(command.m_Damage);
                            characterAttributes.AddBuff("Drain Health Cooltime", characterAttributes.gameObject);
                        }
                    }
                }
            }

            // 아군 동료
            else if (command.m_Attacker.GetComponent <AIAttributte>() != null)
            {
                AIAttributte aIAttributte = command.m_Attacker.GetComponent <AIAttributte>();

                if (command.attackType == AttackType.MainWeapon || command.attackType == AttackType.SubWeapon)
                {
                    if (command.attackType == AttackType.MainWeapon && aIAttributte.GetComponent <WeaponManager>().m_MainWeapon == "009" /*&& aIAttributte.SearchBuff("Party Mood Maker Cooltime") == null*/)        // 파티 분위기 메이커 (스턴)
                    {
                        int stunChance = Random.Range(1, 10);

                        if (stunChance == 1)
                        {
                            command.m_Target.GetComponent <AIAttributte>().AddBuff("Stun", command.m_Attacker);

                            /*aIAttributte.AddBuff("Party Mood Maker Cooltime", aIAttributte.gameObject);*/
                        }
                    }

                    if (aIAttributte.SearchPerk(2001) != null)         // 방사능 디버프
                    {
                        command.m_Target.GetComponent <AIAttributte>().AddBuff("Radiation", command.m_Attacker);
                    }

                    if (aIAttributte.SearchPerk(2005) != null)         // 대구경탄(스턴)
                    {
                        command.m_Target.GetComponent <AIAttributte>().AddBuff("Stun", command.m_Attacker);
                    }

                    if (aIAttributte.SearchPerk(2006) != null)         // 소이탄(발화)
                    {
                        command.m_Target.GetComponent <AIAttributte>().AddBuff("Burn", command.m_Attacker);
                    }

                    // 스위치탄
                    buffTemp = aIAttributte.SearchBuff("Switch ON");
                    if (buffTemp != null)
                    {
                        addDamage += buffTemp.value[buffTemp.currentStack - 1];
                        buffTemp   = null;
                    }

                    // 키클롭스 데미지 2배 장판버프
                    buffTemp = aIAttributte.SearchBuff("Damage Buff");
                    if (buffTemp != null)
                    {
                        addDamage += command.m_Damage;
                        buffTemp   = null;
                    }

                    if (addDamage != 0)
                    {
                        if (aIAttributte.SearchPerk(2003) != null)         // 쉴드 드레인
                        {
                            aIAttributte.DrainShield(command.m_Damage + addDamage);
                        }

                        if (aIAttributte.isDrainHealth)         // HP 드레인
                        {
                            aIAttributte.isDrainHealth = false;
                            aIAttributte.DrainHealth(command.m_Damage + addDamage);
                            aIAttributte.AddBuff("Drain Health Cooltime", aIAttributte.gameObject);
                        }

                        command.m_Target.GetComponent <EnemyController>().GetDamage(command.m_Damage + addDamage, command.m_Attacker, command.attackType);
                        break;
                    }
                    else
                    {
                        if (aIAttributte.SearchPerk(2003) != null)         // 쉴드 드레인
                        {
                            aIAttributte.DrainShield(command.m_Damage);
                        }

                        if (aIAttributte.isDrainHealth)         // HP 드레인
                        {
                            aIAttributte.isDrainHealth = false;
                            aIAttributte.DrainHealth(command.m_Damage);
                            aIAttributte.AddBuff("Drain Health Cooltime", aIAttributte.gameObject);
                        }
                    }
                }
            }

            command.m_Target.GetComponent <EnemyController>().GetDamage(command.m_Damage, command.m_Attacker, command.attackType);
        }
        break;

        case E_ObjectType.Gimmick:
            command.m_Target.GetComponent <GimmickObject>().GetDamage(command.m_Damage, command.m_Attacker);
            break;
        }
    }