39 lines
972 B
C#
39 lines
972 B
C#
using System.Collections;
|
|
using UnityEngine;
|
|
|
|
public class Projectile_MultiHitFollowShooter : ProjectileBase
|
|
{
|
|
[Header("히트박스")]
|
|
public Collider m_Collider;
|
|
[Header("다단히트 딜레이 시간")]
|
|
public float HitDelayTime = 0.5f;
|
|
|
|
public override void Set(ProjectileData _data)
|
|
{
|
|
base.Set(_data);
|
|
if (DSUtil.CheckNull(m_Collider)) m_Collider = GetComponent<Collider>();
|
|
StartCoroutine(Co_HitUpdate());
|
|
}
|
|
|
|
IEnumerator Co_HitUpdate()
|
|
{
|
|
while (m_LifeTime > 0f)
|
|
{
|
|
m_Collider.enabled = true;
|
|
yield return null;
|
|
m_Collider.enabled = false;
|
|
yield return new WaitForSeconds(HitDelayTime);
|
|
m_LifeTime -= HitDelayTime;
|
|
}
|
|
|
|
Off(true);
|
|
}
|
|
|
|
|
|
private void Update()
|
|
{
|
|
transform.position = m_ProjecTileData.shooter.Get_position();
|
|
if (m_ProjecTileData.shooter.IsDead())
|
|
Off(true);
|
|
}
|
|
} |