using System.Collections; using System.Collections.Generic; using UnityEngine; public class Skill_BrutalSlash : ProjectileBase { [Header("기본 투사체")] public string m_projectile = "Projectile_BrutalSlash"; [Header("투사체 지속 시간")] public float projectileTime = 2f; [Header("마지막 투사체")] public string m_projectilelast = "Projectile_BrutalSlashLast"; List list_PD = new List { new ProjectileData(),new ProjectileData(),new ProjectileData(),new ProjectileData(), }; public override void Set(ProjectileData _data) { base.Set(_data); _data.LifeTime = projectileTime; for (int i = 0; i < list_PD.Count; i++) _data.Copy(list_PD[i]); StartCoroutine(Co_Update()); } IEnumerator Co_Update() { int i = 0; yield return new WaitForSeconds(0.3f); Shoot_Projectile(i++, m_projectile); yield return new WaitForSeconds(0.3f); Shoot_Projectile(i++, m_projectile); yield return new WaitForSeconds(0.4f); Shoot_Projectile(i++, m_projectile); yield return new WaitForSeconds(1.0f); Shoot_Projectile(i++, m_projectilelast); yield return null; Off(true); m_ProjecTileData.shooter.Stop(false); } void Shoot_Projectile(int index, string proj) { ProjectileInfo.Ins.Shoot_Projectile(proj, list_PD[index], pb => { Vector3 randomPosition = GetRandomPositionInSector(); pb.m_Pierce = true; pb.transform.position = m_ProjecTileData.shooter.Get_CenterPositionFoward(); pb.transform.LookAt( new Vector3(randomPosition.x, m_ProjecTileData.shooter.Get_Center_position().y, randomPosition.z)); }); } Vector3 GetRandomPositionInSector() { return (Random.insideUnitSphere * 10f) + (m_ProjecTileData.shooter.Get_position() + m_ProjecTileData.shooter.transform.forward * 20f); } }