Exemple #1
0
    public virtual void UseSkill(ushort abilityIndex, bool normal)
    {
        //< 내 스킬의 어빌리티 인지 검증(평타일경우 스킬인덱스는 0이므로, +1을 안시켜줌)
        //if (!normal)
        //    _slot = (uint)(slot + 1);

        //if (!SkillCtr._SkillGroupInfo.GetAbilityContainsKey(_slot, abilityIndex))
        //    return;

        //< 스킬 사용
        //List<SkillTablesLowData.AbilityInfo> skillList = null;

        //if (normal)
        //    skillList = SkillCtr._SkillGroupInfo.GetAbility(_slot, abilityIndex);
        //else

        /*
         * if(Caster.UnitType  == UnitType.Unit)
         * {
         *  byte temp = (Caster as Pc).syncData.SkillData[_slot]._SkillLevel;
         *  skillList = SkillCtr._SkillGroupInfo.GetAbility(_slot, abilityIndex, (uint)temp);
         * }
         * else
         * {
         *  skillList = SkillCtr._SkillGroupInfo.GetAbility(_slot, abilityIndex, null );
         * }
         */


        //skillList = SkillCtr._SkillGroupInfo.GetAbility(_slot, abilityIndex, Caster.UnitType == UnitType.Unit ? (Caster as Pc).syncData.SkillLvDatas : null);
        //skillList = SkillCtr._SkillGroupInfo.GetAbility(_slot, abilityIndex, Caster.UnitType == UnitType.Unit ? (Caster as Pc).syncData.SkillLvDatas : null);

        //< 플레이어에 리더라면 화면에 띄워줌
        //if (!normal && Caster.UnitType == UnitType.Unit && Caster.isLeader)
        //{
        //LocaleLowData.DataInfo localeName = LowDataMgr.GetLocale(GetSkillActionInfo().name);
        //LocaleLowData.DataInfo localedesc = LowDataMgr.GetLocale(skillList[0].skillDec);

        //if (localeName != null && localedesc != null)
        //{
        ////스킬사용시 해당 스킬의 설명과 아이콘에 관한 정보를 HUD로 전달
        ////EventListner.instance.TriggerEvent("HUD_MSG", string.Format("{0}\n{1}", localeName.title, localedesc.title));
        ////EventListner.instance.TriggerEvent("HUD_MSG_ICON", GetSkillActionInfo().icon);
        //}
        //}

        //for (int i = 0; i < skillList.Count; i++)
        //SkillAbility.ActiveSkill(SkillCtr.__SkillGroupInfo.AbilityDic[_slot][abilityIndex], Caster, true);

        AbilityData ability = SkillCtr.__SkillGroupInfo.GetAbility(GetSkillActionInfo().idx, (uint)abilityIndex);

        if (ability != null)
        {
            SkillAbility.ActiveSkill(ability, Caster, normal);
        }
        else
        {
            Debug.Log(string.Format("AbilityNotFound:skillIdx:{0},AbilityIdx:{1}", GetSkillActionInfo().idx, abilityIndex));
        }
    }
    /// 이미 스킬애니메이션은 시작됐고, 실제 스킬 데이터가 적용되어야 하는 시점에 불리는 함수.
    public void SkillUse(int verifyId)
    {
        if (MyUnit == null)
        {
            return;
        }

        if (MyUnit.CurrentState == UnitState.Dying || MyUnit.CurrentState == UnitState.Dead || MyUnit.CharInfo.Hp <= 0)
        {
            return;
        }

        if (callBack != null)
        {
            callBack(verifyId);
        }


        if (!SceneManager.instance.IsRTNetwork || (SceneManager.instance.IsRTNetwork && (MyUnit.m_rUUID == NetData.instance._userInfo._charUUID)))
        {
            if (MyUnit.CurrentState == UnitState.Attack || MyUnit.CurrentState == UnitState.ManualAttack)
            {
                AbilityData ability = MyUnit.SkillCtlr.__SkillGroupInfo.GetAbility(MyUnit.UseSkillIdx, (uint)verifyId);

                if (ability != null)
                {
                    SkillAbility.ActiveSkill(ability, MyUnit, true);
                }
                else
                {
                    Debug.Log("Notfound AbilityData : " + MyUnit.UseSkillIdx + ", " + verifyId);
                }

                //MyUnit.StartSkill((uint)verifyId, true);
            }
            else if (MyUnit.CurrentState == UnitState.Skill)
            {
                AbilityData ability = MyUnit.SkillCtlr.__SkillGroupInfo.GetAbility(MyUnit.UseSkillIdx, (uint)verifyId);

                if (ability != null)
                {
                    SkillAbility.ActiveSkill(ability, MyUnit, false);
                }
                else
                {
                    Debug.Log("Notfound AbilityData : " + MyUnit.UseSkillIdx + ", " + verifyId);
                }

                //MyUnit.StartSkill((uint)verifyId, false);
            }
        }

        Sw.PMsgRoleAttackRecvS attackData = MyUnit.DamageDequeue();

        if (attackData != null)
        {
            //표시할 데이터가 있으면 일단 그냥 표시
            for (int i = 0; i < attackData.CInfo.Count; i++)
            {
                Unit target   = null;
                Unit attacker = null;

                if (attackData.CInfo[i].UnTargetType == (int)Sw.ROLE_TYPE.ROLE_TYPE_USER)
                {
                    target = G_GameInfo.CharacterMgr.FindRoomUnit((ulong)attackData.CInfo[i].UllTargetId);
                }
                else if (attackData.CInfo[i].UnTargetType == (int)Sw.ROLE_TYPE.ROLE_TYPE_NPC)
                {
                    target = G_GameInfo.CharacterMgr.FindRoomNPC((ulong)attackData.CInfo[i].UllTargetId);
                }

                if (attackData.UnAttackerType == (int)Sw.ROLE_TYPE.ROLE_TYPE_USER)
                {
                    attacker = G_GameInfo.CharacterMgr.FindRoomUnit((ulong)attackData.UllAttackerId);
                }
                else if (attackData.UnAttackerType == (int)Sw.ROLE_TYPE.ROLE_TYPE_NPC)
                {
                    attacker = G_GameInfo.CharacterMgr.FindRoomNPC((ulong)attackData.UllAttackerId);
                }

                if (attacker != null)
                {
                    attacker.CharInfo.SuperArmor = (uint)attackData.UnSuperArmor;
                }

                if (target != null)
                {
                    if (attackData.CInfo[i].UnDodge == 1)
                    {
                        //회피
                        if (G_GameInfo.GameInfo.BoardPanel != null)
                        {
                            G_GameInfo.GameInfo.BoardPanel.ShowBuff(target.gameObject, target.gameObject, _LowDataMgr.instance.GetStringCommon(21));
                        }
                    }
                    else if (attackData.CInfo[i].UnCritical == 1)
                    {
                        if (NetData.instance._userInfo._charUUID == (ulong)attackData.CInfo[i].UllTargetId)
                        {
                            //해당유닛이 내유닛이다.

                            target.ShowDamagedFx(target, (int)attackData.CInfo[i].UnDamage, true, true, false, eDamResistType.None);
                        }
                        else
                        {
                            //아니다
                            target.ShowDamagedFx(target, (int)attackData.CInfo[i].UnDamage, false, true, false, eDamResistType.None);
                        }
                        target.StartFlickerFx();
                        target.CharInfo.Hp = attackData.CInfo[i].UnTargetHp;
                    }
                    else
                    {
                        if (NetData.instance._userInfo._charUUID == (ulong)attackData.CInfo[i].UllTargetId)
                        {
                            //해당유닛이 내유닛이다.
                            target.ShowDamagedFx(target, (int)attackData.CInfo[i].UnDamage, true, false, false, eDamResistType.None);
                        }
                        else
                        {
                            target.ShowDamagedFx(target, (int)attackData.CInfo[i].UnDamage, false, false, false, eDamResistType.None);
                        }
                        target.StartFlickerFx();
                        target.CharInfo.Hp = attackData.CInfo[i].UnTargetHp;
                    }


                    target.CharInfo.SuperArmor = (uint)attackData.CInfo[i].UnTargetSuperArmor;
                }
            }
        }


        /*
         * if (MyUnit.CurrentState == UnitState.Attack || MyUnit.CurrentState == UnitState.ManualAttack)
         * {
         *  //< 콤보 예외처리
         *  int combo = MyUnit.CurCombo;
         *  if(MyUnit.CurrentState == UnitState.Attack || MyUnit.CurrentState == UnitState.ManualAttack)
         *  {
         *      if (MyUnit.CurCombo == 1)
         *          combo = 1;
         *      else if (MyUnit.CurCombo == 2)
         *          combo = 2;
         *      else if (MyUnit.CurCombo == 3)
         *          combo = 3;
         *      else if (MyUnit.CurCombo == 0)
         *          combo = 4;
         *
         *      //Debug.Log(string.Format("combo count:{0}, MyUnit.CurCombo:{1}", combo, MyUnit.CurCombo));
         *  }
         *
         *  //< 스킬 시전
         *  //MyUnit.StartSkill(0, (uint)combo, true);
         *
         *  //MyUnit.StartSkill(0, (uint)combo);
         *  Debug.Log(string.Format("verifyId:{0}, MyUnit.UseSkillSlot:{1}", verifyId, MyUnit.UseSkillSlot));
         *  MyUnit.StartSkill((uint)verifyId, true);
         * }
         * else if (MyUnit.CurrentState == UnitState.Skill)
         * {
         *  //< 스킬을 시전한다.
         *  //Debug.Log("UseSkillSlot " + MyUnit.UseSkillSlot + " , verifyId " + verifyId);
         *  MyUnit.StartSkill((uint)verifyId, false);
         * }
         */
    }