Project_WL/Assets/Script/Character/Projectile/Projectile/Projectile_FollowShooter.cs

27 lines
787 B
C#

using System.Collections;
using UnityEngine;
public class Projectile_FollowShooter : ProjectileBase
{
public bool FollowTarget;
public override void Set(ProjectileData _data)
{
base.Set(_data);
m_ShowTimeOverEffect = false; // 근접 공격은 시간 다 됐을 때 이펙트 표시 x
transform.eulerAngles = Vector3.zero; // 근접 공격 판정은 회전 x
StartCoroutine(Co_Update());
}
IEnumerator Co_Update()
{
while (m_ProjecTileData.LifeTime > 0f)
{
yield return null;
m_ProjecTileData.LifeTime -= Time.deltaTime;
transform.position = FollowTarget ? m_ProjecTileData.target.Get_position() : m_ProjecTileData.shooter.Get_position();
}
Off(true);
}
}