public bool Attack_Object(GameObject target, E_ObjectType targetType, AttackType attackType, int Damage, GameObject attacker)
    {
        AttackCommand command = new AttackCommand();

        command.m_Attack_Function = new AttackCommand.AttackDelegate(GiveDamage);
        command.m_Attacker        = attacker;
        command.m_Target          = target;
        command.attackType        = attackType;
        command.m_Type            = targetType;
        command.m_Damage          = Damage;

        attackCommands.Add(command);
        return(true);
    }
Exemplo n.º 2
0
 public bool Decode(BinaryDecoder decoder)
 {
     if (!BinaryCodec.Decode(decoder, out _id))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _assetName))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _spriteName))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _numIndex))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _numX))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _numY))
     {
         return(false);
     }
     {
         int enumValue = 0;
         if (!BinaryCodec.Decode(decoder, out enumValue))
         {
             return(false);
         }
         _objType = (E_ObjectType)enumValue;
     }
     if (!BinaryCodec.Decode(decoder, out _option))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _subPath))
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 3
0
        public GameObject GetInactiveObject(E_ObjectType inType)
        {
            List <GameObject> localList = myLists[inType];

            if (localList != null)
            {
                for (int i = 0; i < localList.Count; ++i)
                {
                    if (!localList[i].activeSelf)
                    {
                        return(localList[i]);
                    }
                }

                GameObject localObj = null;

                if (localList.Count > 0)
                {
                    localObj = Instantiate(localList[0]);
                    localObj.SetActive(false);
                    localList.Add(localObj);
                    return(localObj);
                }
                else
                {
                    for (int i = 0; i < ObjectSamples.Length; ++i)
                    {
                        if (ObjectSamples[i].ObjType == inType)
                        {
                            localObj = Instantiate(localList[0]);
                            localObj.SetActive(false);
                            localList.Add(localObj);
                            return(localObj);
                        }
                    }
                }
            }

            return(null);
        }
    public void ToggleObject(E_ObjectType TargetType)
    {
        if (TargetType == ObjectType)
        {
            if ((int)ObjectType <= 3)
            {
                StartCoroutine(ToggleBlocks(false));
                return;
            }

            gameObject.SetActive(false);        // set Target gameobjects to false.
        }
        else if (!gameObject.activeSelf | (int)ObjectType <= 3)
        {
            if ((int)ObjectType <= 3 && Blocks_Del.Count > 0)
            {
                StartCoroutine(ToggleBlocks(true));
                return;
            }
            gameObject.SetActive(true);     // set objects back to enabled when they are not the target.
        }
    }
 public static void ToggleObject(E_ObjectType Target)
 {
     ItemToggle(Target);
 }
    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;
        }
    }