Project_WL/Assets/Script/Character/Projectile/Skill/Skill_DeathBlade.cs

57 lines
1.8 KiB
C#

using System.Collections;
using UnityEngine;
public class Skill_DeathBlade : ProjectileBase
{
public GameObject go_dagger, go_nextattack;
[Header("단검 속도")]
public float speed = 4f;
[Header("단검 유지시간")]
public float lifetime = 4f;
Coroutine CoStrait, CoOff;
public override void Set(ProjectileData _data)
{
_data.Action_OnHit = hitter =>
{ // 단검을 맞췄을 경우
if (go_dagger.activeInHierarchy)
{
_data.Action_OnHit = null;
StopCoroutine(CoStrait); CoStrait = null;
StopCoroutine(CoOff); CoOff = null;
go_dagger.SetActive(false);
InGameInfo.Ins.Show_Effect("Effect_Teleport", _data.shooter.Get_position());
_data.shooter.Set_Invisible(1.0f, () =>
{
_data.shooter.Set_Warp(hitter.Get_PositionBack());
_data.shooter.Play_Skill("bd_skill3_next");
StartCoroutine(Co_JoyStick(hitter));
});
}
};
go_dagger.SetActive(true);
go_nextattack.SetActive(false);
_data.Speed = speed;
_data.LifeTime = lifetime;
_data.eStartPos = eProjectileStartPos.ShooterCenter;
base.Set(_data);
CoStrait = StartCoroutine(Co_Move_Strait(eProjectileStrait.Forward));
CoOff = StartCoroutine(Co_Off(lifetime));
}
IEnumerator Co_JoyStick(Actor hitter)
{
OptionInfo.Ins.Set_PCMove(hitter, false);
yield return new WaitForSeconds(0.2f);
go_nextattack.SetActive(true);
go_nextattack.transform.position = hitter.Get_Center_position();
yield return new WaitForSeconds(0.3f);
OptionInfo.Ins.Set_PCMove(hitter, true);
yield return new WaitForSeconds(0.5f);
Off(true);
}
}