//< 실질적 스킬 적용 public static void ApplySkill(SkillType skillType, AbilityData _ability, Unit _Caster, Unit _Target, bool normal = false) { float affectValue = CalcAffectValue(_ability, _Caster, _Target); switch (skillType) { case SkillType.Attack: //일반 공격 case SkillType.AttackBuff: if (_Target != null) { //SkillTables.ActionInfo _action = _LowDataMgr.GetSkillAction(_ability.Idx); //슈퍼아머 계산은 먼저 해야함 //if (_ability != null) //{ // uint beforeSuperArmor = _Target.CharInfo.SuperArmor; // //슈퍼아머값 감소 // if (_Target.CharInfo.SuperArmor <= _ability.superArmorDmg) // { // _Target.CharInfo.SuperArmor = 0; // //0일경우만 회복을 시키고 아닐경우는 무시하자 // if (_Target.SuperRecoveryTick == 0f) // { // if(beforeSuperArmor!=0) // { // Transform effTrans = G_GameInfo.SpawnEffect("Fx_SuperArmor_Delete", _Target.cachedTransform.position, Quaternion.Euler(Vector3.zero)); // if (effTrans != null) // { // FxMakerPoolItem poolItem = effTrans.GetComponent<FxMakerPoolItem>(); // if (poolItem == null) // { // poolItem = effTrans.gameObject.AddComponent<FxMakerPoolItem>(); // poolItem.destroyTime = 10; // } // poolItem.Owner = _Target; // poolItem.SetAttach(_Target.transform); // } // SoundManager.instance.PlaySfxUnitSound(0, _Target._audioSource, _Target.cachedTransform, true); // } // _Target.SuperRecoveryTick = _Target.CharInfo.SuperArmor_RecoveryTime; // } // } // else // { // _Target.CharInfo.SuperArmor = _Target.CharInfo.SuperArmor - _ability.superArmorDmg; // } // //공격자측의 슈퍼아머 회복 // _Caster.CharInfo.SuperArmor += _ability.superArmorRecovery; // _Caster.CharInfo.SuperArmor = (uint)Mathf.Clamp(_Caster.CharInfo.SuperArmor, 0, _Caster.CharInfo.MaxSuperArmor); //} //if (_ability.callBuffIdx != 0) //{ // if (_Target != null && _Target.BuffCtlr != null) // { // _Target.BuffCtlr.AttachBuff(_Caster, _Target, _Caster.SkillCtlr.__SkillGroupInfo.GetBuff(_ability.callBuffIdx, _ability.Idx), _ability.rate, _ability.durationTime); // } //} _Target.TakeDamage(_Caster, 1.0f, affectValue, _ability.ignoreDef, eAttackType.All, !normal, _ability, false, false); } break; case SkillType.Projecttile: //발사체 발사 SkillTables.ProjectTileInfo _projecttiledata = _LowDataMgr.GetSkillProjectTileData(_ability.callAbilityIdx); Vector3 dirVec = _Caster.transform.forward; if (_projecttiledata.startType == 3) { Transform[] temp = _Caster.GetComponentsInChildren <Transform>(true); for (int i = 0; i < temp.Length; i++) { if (temp[i] != null && temp[i].name.Equals("cast_dummy_01")) { Vector3 temp1 = _Caster.cachedTransform.position; Vector3 temp2 = temp[i].position; temp1.y = 0; temp2.y = 0; Vector3 temppos = temp1 - temp2; float distance = temppos.magnitude; dirVec = temppos / distance; break; } } } //< 발사체 생성 if (SceneManager.instance.IsRTNetwork && (_Caster.m_rUUID == NetData.instance._userInfo._charUUID)) { //발사체 생성 서버로 보내주자 NetworkClient.instance.SendPMsgBattleAddProjectTileC((int)_ability.Idx, _ability.notiIdx, (int)_ability.callAbilityIdx, _Caster.BeforePosX, _Caster.BeforePosY, _Caster.BeforePosX, _Caster.BeforePosY, 10f, 10f, dirVec); break; } else { _Caster.SpawnProjectile(_LowDataMgr.GetSkillProjectTileData(_ability.callAbilityIdx), (int)affectValue, _Caster.TeamID, dirVec, _Caster, _Target, _ability, 0, normal); break; } case SkillType.Buff: //< 버프 생성 //황비홍 프로젝트 - 버프일단 무시 if (_Target != null && _Target.BuffCtlr != null) { _Target.BuffCtlr.AttachBuff(_Caster, _Target, _Caster.SkillCtlr.__SkillGroupInfo.GetBuff(_ability.callBuffIdx, _ability.Idx), _ability.rate, _ability.durationTime); //< 주변적들에게 모두 넉백(자신에게 사용하는 버프만) if (_Target == _Caster) { List <Unit> targetList = GetTargetList(1, _Caster); SkillTables.ActionInfo _action = _LowDataMgr.GetSkillAction(_ability.Idx); float radius = (ushort)(_ability.radius + _action.range); for (int i = 0; i < targetList.Count; i++) { if (targetList[i] == null || targetList[i].IsDie) { continue; } if (!MathHelper.IsInRange((targetList[i].transform.position - _Caster.transform.position), radius, _Caster.Radius, targetList[i].Radius)) { continue; } targetList[i].SetPush(_ability.pushpower, _Caster.gameObject, 1); } } } break; case SkillType.Heal: //체력 회복 또는 감소 if (affectValue > 0 && _Target != null) { _Target.SetHp(_Caster, affectValue); } break; case SkillType.EffectSkill: //< 해당 적 위치에 이펙트 바로 호출하여 공격 //황비홍 프로젝트 - 이펙트 스킬 일단 무시 /* * if (_Target != null && _ability.targetEffect != "0") * { * //if (SimulationGameInfo.SimulationGameCheck) * // UnitSimulation.UseSkillNames.Add(_ability.targetEffect); * * _Target.SpawnEffect(_ability.targetEffect, 1, _Target.transform, null, false, (skillCastingEff) => * { * //< 사운드 실행 * if (_ability.targetSound > 0) * SoundHelper.PlaySfxSound(_ability.targetSound, 1.5f); * * //< 각도만 캐스터 방향으로 보정해준다 * skillCastingEff.transform.localRotation = _Caster.transform.localRotation; * * // 1. 이펙트 자식중에 충돌체가 있는지 찾도록 한다. * Collider[] existCol = skillCastingEff.GetComponentsInChildren<Collider>(true); * if (null != existCol) * { * for (int j = 0; j < existCol.Length; j++) * SetTriggerEvent(existCol[j], _Caster, affectValue, _ability); * } * * //< 이펙트에 듀플리케이트가 있을경우 연결해줌 * NcDuplicator _NcDuplicator = skillCastingEff.GetComponentInChildren<NcDuplicator>(); * if (_NcDuplicator != null) * { * _NcDuplicator._CallBack = (trn) => * { * Collider[] existCol2 = trn.gameObject.GetComponentsInChildren<Collider>(true); * if (null != existCol2) * { * for (int j = 0; j < existCol2.Length; j++) * SetTriggerEvent(existCol2[j], _Caster, affectValue, _ability); * } * }; * } * }, _Caster.Model.Main.transform.localScale.x); * } */ break; } }
public void Setup(SkillTables.ProjectTileInfo _projecttile, AbilityData _ability, int _Damage, int _teamIndex, Vector3 _dir, Unit _owner, Unit _target, ulong _projectTileId, bool _normal = false) { Reset(); //< 레이어 설정 if (_owner != null) { this.gameObject.layer = _owner.gameObject.layer; } //< 정보 대입 projectileInfo = _projecttile; ProjectTileId = _projectTileId; damage = _Damage; dir = _dir; Owner = _owner; TargetUnit = _target; normal = _normal; penetrateCount = projectileInfo.penetrateCount; abilityData = _ability; ////< 시뮬레이션 상태일때는 에러 뱉어줌 //if (SimulationGameInfo.SimulationGameCheck) //{ // if (projectileInfo.penetrate == 1 && penetrateCount == 1) // UIMgr.instance.OpenToastPanel("[Error] penetrate == 1 && penetrateCount == 1"); //} //< 타입 설정 ProjectileType = TargetUnit != null ? eProjectileType.OneTarget : eProjectileType.NonTarget; //< 타겟이 있을시 오프셋위치를 잡는다 if (TargetUnit != null) { BoxCollider collide = TargetUnit.GetComponent <BoxCollider>(); float height = (collide != null ? (collide.bounds.max.y / 2) : 1); if (height < 0) { height *= -1; } //OffsetPos = height; } //< 적 리스트를 얻어온다. SetTargetList(); //< 모델 생성 CreateModel(); //즉시 날라가는 스킬의 경우만 if (projectileInfo.Type == 0) { //< 이동속도가 0이라면, 상대에게 바로 이동시켜준다 if (ProjectileType == eProjectileType.OneTarget && projectileInfo.moveSpeed == 0 && _target != null) { this.transform.position = _target.transform.position; } } else if (_projecttile.Type == 1) { DestroyTime = Time.time + projectileInfo.durationTime; NextDamageTime = projectileInfo.damageinterval; } }