2026-05-22 보스스킬 : 지진
This commit is contained in:
43
Assets/02_Scripts/Enemy/Skills/EarthquakeSkill.cs
Normal file
43
Assets/02_Scripts/Enemy/Skills/EarthquakeSkill.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System.Threading;
|
||||
using UnityEngine;
|
||||
|
||||
public class EarthquakeSkill : BossSkill
|
||||
{
|
||||
[Header("EarthquakeSkill")]
|
||||
[SerializeField] private float _windup = 0.5f; // 애니 시작 ~ 피해 판정 ON
|
||||
[SerializeField] private float _activeDuration = 1.5f; // 피해 판정 유지 시간
|
||||
[SerializeField] private float _recovery = 0.6f; // 판정 OFF 후 후딜
|
||||
[SerializeField] private int _damage = 15;
|
||||
[SerializeField] private float _liftForce = 0.5f; // 지면 피격 시 띄우는 세기
|
||||
|
||||
protected override async Awaitable RunSkill(CancellationToken token)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 선딜
|
||||
await Awaitable.WaitForSecondsAsync(_windup, token);
|
||||
|
||||
Earthquake();
|
||||
|
||||
// 후딜
|
||||
await Awaitable.WaitForSecondsAsync(_recovery, token);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void Earthquake()
|
||||
{
|
||||
PlayerController player = GameManager.Instance.LocalPlayer;
|
||||
if (player == null) return;
|
||||
|
||||
// 플레이어가 지면에 닿아 있을 때만 발동. 공중이면 아무 효과 없음.
|
||||
if (!player.IsGrounded) return;
|
||||
|
||||
// 지면 접촉 중: 살짝 띄우면서 데미지.
|
||||
player.Launch(new Vector2(0f, _liftForce));
|
||||
player.TakeDamage(_damage);
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Enemy/Skills/EarthquakeSkill.cs.meta
Normal file
2
Assets/02_Scripts/Enemy/Skills/EarthquakeSkill.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d27a723f9206afc49a060c2875ccf3dc
|
||||
@@ -19,14 +19,10 @@ public class HazardSkill : BossSkill
|
||||
[SerializeField] private GameObject _hazardHitboxOrigin;
|
||||
[SerializeField] private int _hitBoxDamage = 15;
|
||||
|
||||
private SkillSupport support;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (_animator == null)
|
||||
_animator = GetComponentInChildren<Animator>();
|
||||
|
||||
support = Object.FindFirstObjectByType<SkillSupport>();
|
||||
}
|
||||
|
||||
protected override async Awaitable RunSkill(CancellationToken token)
|
||||
@@ -64,12 +60,7 @@ protected override async Awaitable RunSkill(CancellationToken token)
|
||||
|
||||
private void PredictHazards(int dirChoice)
|
||||
{
|
||||
if(support == null)
|
||||
{
|
||||
Debug.Log("Null이니");
|
||||
}
|
||||
|
||||
SkillPredict[] predicts = dirChoice switch { 0 => support.DownHazardPredicts, 1=> support.RightHazardPredicts, _=> null};
|
||||
SkillPredict[] predicts = dirChoice switch { 0 => GameManager.Instance.SkillSupporter.DownHazardPredicts, 1=> GameManager.Instance.SkillSupporter.RightHazardPredicts, _=> null};
|
||||
|
||||
for (int i = 0; i < predicts.Length; i++)
|
||||
{
|
||||
@@ -80,7 +71,7 @@ private void PredictHazards(int dirChoice)
|
||||
|
||||
private void FireHazards(int dirChoice)
|
||||
{
|
||||
Transform[] hazardPoss = dirChoice switch { 0 => support.DownHazardFirePos, 1=> support.RightHazardFirePos, _=> null};
|
||||
Transform[] hazardPoss = dirChoice switch { 0 => GameManager.Instance.SkillSupporter.DownHazardFirePos, 1=> GameManager.Instance.SkillSupporter.RightHazardFirePos, _=> null};
|
||||
Vector2 attackDir = dirChoice switch {0 => Vector2.down,1=>Vector2.right,_=>Vector2.left};
|
||||
|
||||
if (hazardPoss == null) return;
|
||||
|
||||
@@ -8,7 +8,12 @@ public class SkillSupport : MonoBehaviour
|
||||
[HideInInspector] public SkillPredict[] DownHazardPredicts;
|
||||
[HideInInspector] public SkillPredict[] RightHazardPredicts;
|
||||
|
||||
void Start()
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
GameObject[] shineDownStartPoss = GameObject.FindGameObjectsWithTag("ShineDownStartPos");
|
||||
GameObject[] shineRightStartPoss = GameObject.FindGameObjectsWithTag("ShineRightStartPos");
|
||||
|
||||
Reference in New Issue
Block a user