66 lines
2.1 KiB
C#
66 lines
2.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Skill_Hurricane : ProjectileBase
|
|
{
|
|
[Header("소용돌이 유지 시간")]
|
|
public float lifeTime = 15f;
|
|
[Header("소용돌이 데미지 범위")]
|
|
public BoxCollider m_Collider;
|
|
[Header("데미지 간격")]
|
|
public float damageGap = 0.33f;
|
|
[Header("소용돌이 이동속도")]
|
|
public float movespeed = 1f;
|
|
|
|
public override void Set(ProjectileData _data)
|
|
{
|
|
base.Set(_data);
|
|
transform.position = _data.target.Get_position();
|
|
transform.eulerAngles = Vector3.zero;
|
|
movespeed += IsStep(1) ? Get_AwakenData(1, 1) : 0f;
|
|
_data.LifeTime = lifeTime + (IsStep(2) ? Get_AwakenData(2, 1) : 0f);
|
|
|
|
StartCoroutine(Co_Update());
|
|
}
|
|
|
|
IEnumerator Co_Update()
|
|
{
|
|
if (IsStep(3)) m_Collider.size = new Vector3(1.70440888f, 3.86459613f, 1.84529209f);
|
|
else m_Collider.size = new Vector3(1.37568462f, 3.86459613f, 1.46960735f);
|
|
|
|
while (m_ProjectTileData.LifeTime > 0f)
|
|
{
|
|
m_Collider.enabled = true;
|
|
yield return null;
|
|
yield return null;
|
|
m_Collider.enabled = false;
|
|
yield return new WaitForSeconds(damageGap);
|
|
m_ProjectTileData.LifeTime -= damageGap;
|
|
}
|
|
|
|
Off(true);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!DSUtil.CheckNull(m_ProjectTileData.target) && !m_ProjectTileData.target.IsDead())
|
|
{
|
|
var targetpos = m_ProjectTileData.target.Get_position();
|
|
transform.position = Vector3.MoveTowards(transform.position, targetpos, Time.deltaTime * movespeed);
|
|
|
|
// Create a new position with the y value you want
|
|
Vector3 newPosition = transform.position;
|
|
newPosition.y = 0.01f; // Set the y-value
|
|
transform.position = newPosition;
|
|
}
|
|
else
|
|
{
|
|
m_ProjectTileData.target = Get_NearstEnemy();
|
|
if (DSUtil.CheckNull(m_ProjectTileData.target))
|
|
Off(true);
|
|
}
|
|
|
|
if (m_ProjectTileData.shooter.IsDead()) Off();
|
|
}
|
|
} |