46 lines
1.7 KiB
C#
46 lines
1.7 KiB
C#
using System.Collections;
|
|
using UnityEngine;
|
|
|
|
public class Skill_UnpredictableArrow : ProjectileBase
|
|
{
|
|
[Header("투사체 프리팹")]
|
|
public string projectile_prefab = "Projectile_RookieArcherSkill1";
|
|
[Header("투사체 갯수")]
|
|
public int m_count = 10;
|
|
[Header("투사체 속도")]
|
|
public float m_speed = 1.5f;
|
|
[Header("최소 좌우 진폭")]
|
|
public float MinwaveAmplitude = 0f;
|
|
[Header("최대 좌우 진폭")]
|
|
public float MaxwaveAmplitude = 2f;
|
|
[Header("최소 좌우 주파수")]
|
|
public float MinwaveFrequency = 1f;
|
|
[Header("최대 좌우 주파수")]
|
|
public float MaxwaveFrequency = 3f;
|
|
|
|
public override void Set(ProjectileData _data)
|
|
{
|
|
_data.eStartPos = eProjectileStartPos.ShooterCenter;
|
|
_data.Speed = m_speed;
|
|
base.Set(_data);
|
|
StartCoroutine(Co_Update());
|
|
}
|
|
|
|
IEnumerator Co_Update()
|
|
{
|
|
m_ProjectTileData.shooter.AnimationPlay("skill1_loop");
|
|
for (int i = 0; i < m_count; i++)
|
|
{
|
|
yield return new WaitForSeconds(0.25f);
|
|
ProjectileInfo.Ins.Shoot_Projectile(projectile_prefab, m_ProjectTileData, pb =>
|
|
{
|
|
pb.transform.localScale = Vector3.one * 0.5f;
|
|
var target = m_ProjectTileData.shooter.Get_CenterPositionFoward(Random.Range(3f, 6f));
|
|
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_ProjectTileData.shooter.Play_Idle();
|
|
}
|
|
} |