67 lines
2.4 KiB
C#
67 lines
2.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Skill_UnpredictableArrow : ProjectileBase
|
|
{
|
|
[Header("투사체 프리팹")]
|
|
public string projectile_prefab = "Projectile_RookieArcherSkill1";
|
|
[Header("투사체 갯수")]
|
|
public int m_count = 10;
|
|
[Header("다음 투사체 발사 딜레이")]
|
|
public float m_delay = 0.15f;
|
|
[Header("투사체 속도")]
|
|
public float m_speed = 1.5f;
|
|
[Header("최소 도달 거리")]
|
|
public float MinDistance = 5f;
|
|
[Header("최대 도달 거리")]
|
|
public float MaxDistance = 10f;
|
|
[Header("최소 좌우 진폭")]
|
|
public float MinwaveAmplitude = 0f;
|
|
[Header("최대 좌우 진폭")]
|
|
public float MaxwaveAmplitude = 2f;
|
|
[Header("최소 좌우 주파수")]
|
|
public float MinwaveFrequency = 1f;
|
|
[Header("최대 좌우 주파수")]
|
|
public float MaxwaveFrequency = 3f;
|
|
|
|
List<ProjectileData> list_projectile = new List<ProjectileData>();
|
|
|
|
public override void Set(ProjectileData _data)
|
|
{
|
|
if (list_projectile.Count < m_count)
|
|
{
|
|
var addCount = m_count - list_projectile.Count;
|
|
for (int i = 0; i < addCount; ++i)
|
|
list_projectile.Add(new ProjectileData());
|
|
}
|
|
|
|
_data.eStartPos = eProjectileStartPos.ShooterCenter;
|
|
_data.Speed = m_speed;
|
|
base.Set(_data);
|
|
StartCoroutine(Co_Update());
|
|
}
|
|
|
|
IEnumerator Co_Update()
|
|
{
|
|
for (int i = 0; i < list_projectile.Count; i++)
|
|
m_ProjecTileData.Copy(list_projectile[i]);
|
|
|
|
m_ProjecTileData.shooter.AnimationPlay("skill1_loop");
|
|
for (int i = 0; i < m_count; i++)
|
|
{
|
|
yield return new WaitForSeconds(m_delay);
|
|
ProjectileInfo.Ins.Shoot_Projectile(projectile_prefab, list_projectile[i], pb =>
|
|
{
|
|
pb.m_Pierce = true;
|
|
pb.transform.localScale = Vector3.one * 0.5f;
|
|
var target = m_ProjecTileData.shooter.Get_CenterPositionFoward(Random.Range(MinDistance, MaxDistance));
|
|
var Amplitude = Random.Range(MinwaveAmplitude, MaxwaveAmplitude);
|
|
var Frequency = Random.Range(MinwaveFrequency, MaxwaveFrequency);
|
|
pb.Launch(transform.position, target, Random.value > 0.5f ? 0f : Mathf.PI, Amplitude, Frequency);
|
|
});
|
|
}
|
|
m_ProjecTileData.shooter.Play_Idle();
|
|
Off(true);
|
|
}
|
|
} |