static void SetTriggerEvent(Collider existCol, Unit _Caster, float affectValue, AbilityData _ability) { //< 있을경우는 삭제 ForwardTriggerEvent OrgtriggerEvt = existCol.gameObject.GetComponent <ForwardTriggerEvent>(); if (OrgtriggerEvt != null) { UIMgr.Destroy(OrgtriggerEvt); } existCol.isTrigger = false; existCol.isTrigger = true; ForwardTriggerEvent triggerEvt = existCol.gameObject.AddComponent <ForwardTriggerEvent>(); triggerEvt.Setup(_Caster, _ability); triggerEvt.TriggerEnter_Unit = (target, ForwardTriggerEvent) => { if (target != null) { //< 대미지 target.TakeDamage(_Caster, 1.0f, affectValue, 0, eAttackType.All, true, null); //황비홍 프로젝트에 맞게 수정 버프스킬은 일단 무시 /* * //< 버프 호출이있을시 버프호출 * if (_ability.callBuffIdx != 0 && target.BuffCtlr != null) * //황비홍 프로젝트에 맞게 수정 * target.BuffCtlr.AttachBuff(_Caster, target, _Caster.SkillCtlr._SkillGroupInfo.GetBuff(_ability.callBuffIdx, _ability.unitIdx, _ability.skillIdx, _Caster.UnitType == UnitType.Unit ? (_Caster as Pc).syncData.SkillLvDatas : null), _ability); */ } }; }
private void Attack() { parent.UnitStop = true; if (parent.isLeader) { if (Time.time > ComboKeepTime) { parent.CurCombo = 0; } } if (!SceneManager.instance.IsRTNetwork || (SceneManager.instance.IsRTNetwork && (parent.m_rUUID == NetData.instance._userInfo._charUUID))) { if (parent.UnitType == UnitType.Unit) { parent.FindTarget(); // ** 회전 조절 우선순위 ** // 1. 조이스틱 회전값 // 2. 타겟존재 여부 if (parent.inputCtlr != null && Quaternion.identity != parent.inputCtlr.RotationFromInterJoyStick) { parent.cachedTransform.rotation = parent.inputCtlr.RotationFromInterJoyStick; } else if (parent.GetTarget() != null) { parent.LookAt(parent.GetTarget().cachedTransform.position); } } } if (SceneManager.instance.IsRTNetwork) { if (0 < parent.m_SvComboIdx) //중계 받아온 입장에서만... { parent.CurCombo = parent.m_SvComboIdx; //평타 인덱스 동기화 parent.m_SvComboIdx = -1; } } eAnimName aniName; if (parent is Pc && !parent.IsPartner) { aniName = (eAnimName)((int)eAnimName.Anim_attack1 + parent.CurCombo); } else { aniName = (eAnimName)((int)eAnimName.Anim_attack1); } atkAnimLength = Time.time + parent.Animator.GetAnimLength(aniName) - fadeTime; attackEndTime = 90; int a_OldCombo = parent.CurCombo; if (parent is Pc && !parent.IsPartner) { parent.UseSkillIdx = parent.GetNormalAttackComboSkillID(parent.CurCombo); parent.CurCombo++; } else { parent.UseSkillIdx = parent.GetNormalAttackComboSkillID(0); } if (SceneManager.instance.IsRTNetwork) { //if (parent.IsLeader == true || (parent.IsPartner == true && parent.TeamID == G_GameInfo.PlayerController.Leader.TeamID)) if (parent.m_rUUID == NetData.instance._userInfo._charUUID) { uint a_Combo; a_Combo = parent.GetNormalAttackComboSkillID(a_OldCombo); if (a_Combo == uint.MaxValue) { Debug.Log("NotFound NormalAttack ID"); return; } /* * ////루트 가져오기 * a_RootMoPos = 0.0f; * if (parent.UnitType == UnitType.Unit) * { * _ResourceLowData.AniTableInfo aniInfo = parent.CharInfo.animDatas[(int)aniName]; * if (parent is Pc && aniInfo.rootMotion == true) * { * Pc a_refPc = (Pc)parent; * string animName = a_refPc.Animator.GetAnimName(aniName); * Vector3 a_CacVec = a_refPc.rootMotion.CalcTotalMovingDistance(animName); * a_RootMoPos = a_CacVec.z * 0.7f; * } * } * else if(parent.UnitType == UnitType.Npc) * { * _ResourceLowData.AniTableInfo aniInfo = parent.CharInfo.animDatas[(int)aniName]; * if (parent is Npc && aniInfo.rootMotion == true) * { * Npc a_refNpc = (Npc)parent; * string animName = a_refNpc.Animator.GetAnimName(aniName); * Vector3 a_CacVec = a_refNpc.rootMotion.CalcTotalMovingDistance(animName); * a_RootMoPos = a_CacVec.z * 0.7f; * } * } * * parent.g_CacDamPos = parent.transform.position + (parent.transform.forward * a_RootMoPos); //이미 캐릭터간 간격은 충분히 멀다. 충돌박스로 인하여... 1.8 ~ 2.1 m * //parent.g_CacDamRot = Quaternion.LookRotation(parent.transform.forward).eulerAngles; <--타겟을 이미 바라보고 있기 때문에 이 부분은 않해도 될 것 같다. * * parent.g_AniEvent.ForGetList_SkillUse(1, UnitState.ManualAttack); //<-- 이렇게 해서 타겟의 리스트를 얻어온다. * System.Collections.Generic.List<ulong> a_list = new System.Collections.Generic.List<ulong>(); * a_list.Clear(); * * for (int a_ii = 0; a_ii < parent.g_targetList.Count; a_ii++) * { * a_list.Add(parent.g_targetList[a_ii].m_rUUID); * } * * if (a_list.Count <= 0) * a_list.Add(ulong.MaxValue); */ //iFunClient.instance.ReqSkillStart( parent.m_rUUID, a_Combo, parent.transform.position, parent.transform.eulerAngles.y); //NetworkClient.instance.SendPMsgBattleAttackPrepareC((int)parent.UseSkillIdx, 0, (int)UnitModelHelper.RotateTo8Way(parent.transform.eulerAngles.y)); //일단 서버에 위치보정을 하자 parent.MoveNetworkCalibrate(parent.cachedTransform.position); //pc의 경우 8방향이 아닌 360도를 쓰게 수정 NetworkClient.instance.SendPMsgBattleAttackPrepareC((int)parent.UseSkillIdx, 0, (int)parent.cachedTransform.eulerAngles.y); } //else if (parent.IsPartner == true && parent.TeamID == G_GameInfo.PlayerController.Leader.TeamID) //{ // uint a_Combo = parent.GetNormalAttackComboSkillID(0); // NetworkClient.instance.SendPMsgBattleAttackPrepareC((int)parent.UseSkillIdx, 0, 1); //} } //< 이펙트 실행 string StartEffect = "0"; uint StartSoundID = 0; Resource.AniInfo aniData = parent.GetAniData(aniName); if (aniData != null) { StartEffect = aniData.effect; StartSoundID = aniData.seSkill; } if ("0" != StartEffect && null != parent.Animation[parent.Animator.GetAnimName(aniName)]) { parent.SpawnSkillEffect(StartEffect, parent.Animation[parent.Animator.GetAnimName(aniName)].speed, parent.cachedTransform, aniData.childEffect == 0 ? null : parent.cachedTransform, (skillCastingEff) => //parent.SpawnSkillEffect(StartEffect, parent.Animation[parent.Animator.GetAnimName(aniName)].speed, parent.transform, parent.transform, (skillCastingEff) => { //SoundManager.instance.PlaySfxSound(StartSoundID, parent.cachedTransform); SoundManager.instance.PlaySfxUnitSound(StartSoundID, parent._audioSource, parent.cachedTransform); SoundManager.instance.PlayUnitVoiceSound(parent.GetVoiceID(aniName), parent._audioSource, parent.cachedTransform); //< 애니메이션 실행 //parent.PlayAnim(aniName, true, fadeTime, true); parent.PlayAnim(aniName, true); attackEndTime = atkAnimLength + parent.CharInfo.AtkDelay; ActionInfo actionData = parent.SkillCtlr.__SkillGroupInfo.GetAction(parent.UseSkillIdx); if (actionData != null) { if (actionData.effectCallNotiIdx != 0) { Collider[] existCol = skillCastingEff.GetComponentsInChildren <Collider>(true); for (int j = 0; j < existCol.Length; j++) { //EffectCallAbility = true; //< 있을경우는 삭제 ForwardTriggerEvent OrgtriggerEvt = existCol[j].gameObject.GetComponent <ForwardTriggerEvent>(); if (OrgtriggerEvt != null) { UIMgr.Destroy(OrgtriggerEvt); } existCol[j].isTrigger = false; existCol[j].isTrigger = true; ForwardTriggerEvent triggerEvt = existCol[j].gameObject.AddComponent <ForwardTriggerEvent>(); triggerEvt.TriggerEnter_Unit = FireToTarget; uint skillIdx = parent.SkillCtlr.GetSkillIndex((int)parent.UseSkillSlot); //황비홍 프로젝트 - 프로젝트에 맞게 수정 triggerEvt.Setup(parent, parent.SkillCtlr.__SkillGroupInfo.GetAbility(skillIdx, 1)); } } } }); } else { //SoundManager.instance.PlaySfxSound(StartSoundID, parent.cachedTransform); SoundManager.instance.PlaySfxUnitSound(StartSoundID, parent._audioSource, parent.cachedTransform); //< 시전이펙트가 없을시 바로 애니메이션 실행 parent.PlayAnim(aniName, true, fadeTime, true); attackEndTime = atkAnimLength + parent.CharInfo.AtkDelay; } parent.PreEndAttackAnim = false; parent.ActiveAttack = true; }