81 lines
2.6 KiB
C#
81 lines
2.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Skill_CrossSlash : ProjectileBase
|
|
{
|
|
public List<float> list_gaptime = new List<float> { 0.2f, 0.2f, 0.2f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f };
|
|
public int SlashCount = 13;
|
|
List<Projectile_Strait> projectile_Straits = new List<Projectile_Strait>();
|
|
|
|
bool onAwake;
|
|
|
|
public override void Off_FisrLoad()
|
|
{
|
|
base.Off_FisrLoad();
|
|
var child = transform.GetChild(0).gameObject;
|
|
projectile_Straits.Add(child.GetComponent<Projectile_Strait>());
|
|
for (int i = 1; i < SlashCount; i++)
|
|
{
|
|
var slash = DSUtil.Get_Clone<Projectile_Strait>(child, transform, null, child.transform.localScale);
|
|
projectile_Straits.Add(slash);
|
|
}
|
|
}
|
|
|
|
public override void Set(ProjectileData _data)
|
|
{
|
|
if (!onAwake)
|
|
{
|
|
onAwake = true;
|
|
var ps = GetComponentsInChildren<ParticleSystem>(true);
|
|
for (int i = 0; i < ps.Length; i++)
|
|
{
|
|
var main = ps[i].main;
|
|
main.playOnAwake = true;
|
|
}
|
|
}
|
|
|
|
_data.eStartPos = eProjectileStartPos.ShooterCenter;
|
|
_data.LifeTime = 0.75f;
|
|
base.Set(_data);
|
|
LookAt_ShooterFoward();
|
|
StartCoroutine(Co_Update());
|
|
}
|
|
|
|
IEnumerator Co_Update()
|
|
{
|
|
OptionInfo.Ins.Set_PCMove(m_ProjecTileData.shooter, false);
|
|
|
|
for (int i = 0; i < projectile_Straits.Count; i++)
|
|
projectile_Straits[i].gameObject.SetActive(false);
|
|
|
|
m_ProjecTileData.shooter.AnimationPlay("paladin_skill2_start");
|
|
|
|
float baseAngle = 90f;
|
|
for (int i = 0; i < projectile_Straits.Count; i++)
|
|
{
|
|
projectile_Straits[i].gameObject.SetActive(true);
|
|
projectile_Straits[i].Set(m_ProjecTileData);
|
|
|
|
float angleOffset = 0f;
|
|
|
|
if (i > 0)
|
|
{
|
|
int offsetIndex = (i + 1) / 2;
|
|
float step = offsetIndex * 15f;
|
|
angleOffset = (i % 2 == 1) ? -step : step; // 홀수: 왼쪽, 짝수: 오른쪽
|
|
}
|
|
|
|
float finalAngle = baseAngle + angleOffset;
|
|
projectile_Straits[i].transform.eulerAngles = new Vector3(0f, transform.eulerAngles.y, finalAngle);
|
|
|
|
yield return new WaitForSeconds(list_gaptime[i]);
|
|
}
|
|
|
|
m_ProjecTileData.shooter.Buff_or_Debuff(eCC.DEF_Mul, 2f, 0.5f);
|
|
yield return new WaitForSeconds(2f);
|
|
OptionInfo.Ins.Set_PCMove(m_ProjecTileData.shooter, true);
|
|
m_ProjecTileData.shooter.Play_Idle();
|
|
Off(true);
|
|
}
|
|
} |