68 lines
1.9 KiB
C#
68 lines
1.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Skill_BlackHole : ProjectileBase
|
|
{
|
|
[Header("블랙홀 생성 시간")]
|
|
public float lifetime = 3f;
|
|
[Header("블랙홀 범위")]
|
|
public float range = 5f;
|
|
[Header("블랙홀 데미지 간격")]
|
|
public float damagegap = 0.2f;
|
|
|
|
float m_DagmaeGap;
|
|
|
|
public override void Set(ProjectileData _data)
|
|
{
|
|
_data.eStartPos = eProjectileStartPos.Custom;
|
|
_data.v3_StartPos = _data.target.Get_Center_position();
|
|
base.Set(_data);
|
|
|
|
m_LifeTime = lifetime;
|
|
m_DagmaeGap = damagegap;
|
|
|
|
var skillid = m_ProjectTileData.m_SkillListTableData.n_SkillID;
|
|
if (IsStep(1))
|
|
{
|
|
range += Get_AwakenData(1, 1);
|
|
m_LifeTime += Get_AwakenData(1, 2);
|
|
}
|
|
var StunTime = IsStep(2) ? Get_AwakenData(2, 1) : 0f;
|
|
if (IsStep(3))
|
|
{
|
|
range += Get_AwakenData(3, 1);
|
|
m_DagmaeGap -= Get_AwakenData(3, 2);
|
|
}
|
|
|
|
StartCoroutine(Co_BlackHole(StunTime));
|
|
}
|
|
|
|
IEnumerator Co_BlackHole(float StunTime)
|
|
{
|
|
while (m_LifeTime > 0f)
|
|
{
|
|
Attack_Enemies(Get_Enemies(transform, range), 0f);
|
|
yield return new WaitForSeconds(m_DagmaeGap);
|
|
m_LifeTime -= m_DagmaeGap;
|
|
}
|
|
yield return new WaitForSeconds(0.5f);
|
|
Attack_Enemies(Get_Enemies(transform, range), StunTime);
|
|
|
|
Off();
|
|
}
|
|
|
|
void Attack_Enemies(List<Actor> enemies, float StunTime)
|
|
{
|
|
for (int j = 0; j < enemies.Count; j++)
|
|
{
|
|
if (DSUtil.CheckNull(enemies[j])) continue;
|
|
if (j >= enemies.Count) break;
|
|
|
|
enemies[j].Attract(transform.position);
|
|
if (StunTime > 0f) enemies[j].Stun(StunTime, true);
|
|
enemies[j].Get_Damage(Get_DamageInfo());
|
|
Show_HitEffect(true, enemies[j]);
|
|
}
|
|
}
|
|
} |