2026-05-21 스킬예측(진행중)
This commit is contained in:
@@ -22,6 +22,8 @@ public class HazardSkill : BossSkill
|
||||
[SerializeField] private float _activeDuration = 1.5f; // 피해 판정 유지 시간
|
||||
[SerializeField] private float _recovery = 0.6f; // 판정 OFF 후 후딜
|
||||
[SerializeField] private GameObject _hazardHitboxOrigin;
|
||||
[SerializeField] private int _hitBoxDamage = 15;
|
||||
|
||||
private SkillSupport support;
|
||||
|
||||
private void Awake()
|
||||
@@ -52,6 +54,8 @@ protected override async Awaitable RunSkill(CancellationToken token)
|
||||
_animator.Play(_rightAnimationState);
|
||||
}
|
||||
|
||||
PredictHazards(dirChoice);
|
||||
|
||||
// 선딜
|
||||
await Awaitable.WaitForSecondsAsync(_windup, token);
|
||||
|
||||
@@ -66,20 +70,37 @@ protected override async Awaitable RunSkill(CancellationToken token)
|
||||
}
|
||||
}
|
||||
|
||||
private void PredictHazards(int dirChoice)
|
||||
{
|
||||
SkillPredict[] predicts = dirChoice switch { 0 => support.DownHazardPredicts, 1=> support.RightHazardPredicts, _=> null};
|
||||
|
||||
for (int i = 0; i < predicts.Length; i++)
|
||||
{
|
||||
if(predicts[i] != null)
|
||||
predicts[i].PredictVFX.Play();
|
||||
}
|
||||
}
|
||||
|
||||
private void FireHazards(int dirChoice)
|
||||
{
|
||||
Transform[] _hazardPoss = dirChoice switch { 0 => support.DownHazardFirePos, 1=> support.RightHazardFirePos, _=> null};
|
||||
Transform[] hazardPoss = dirChoice switch { 0 => support.DownHazardFirePos, 1=> support.RightHazardFirePos, _=> null};
|
||||
Vector2 attackDir = dirChoice switch {0 => Vector2.down,1=>Vector2.right,_=>Vector2.left};
|
||||
|
||||
if (_hazardPoss == null) return;
|
||||
if (hazardPoss == null) return;
|
||||
|
||||
for (int i = 0; i < _hazardPoss.Length; i++)
|
||||
for (int i = 0; i < hazardPoss.Length; i++)
|
||||
{
|
||||
GameObject hitbox = Instantiate(_hazardHitboxOrigin,_hazardPoss[i].transform);
|
||||
GameObject hitbox = Instantiate(_hazardHitboxOrigin,hazardPoss[i].transform);
|
||||
HazardHitbox hazardHitbox = hitbox.GetComponent<HazardHitbox>();
|
||||
if(hazardHitbox != null)
|
||||
{
|
||||
hazardHitbox.Damage = _hitBoxDamage;
|
||||
}
|
||||
|
||||
Rigidbody2D hitbox_rb = hitbox.GetComponent<Rigidbody2D>();
|
||||
if(hitbox_rb != null)
|
||||
{
|
||||
hitbox_rb.linearVelocity = attackDir*50.0f;
|
||||
hitbox_rb.AddForce(attackDir*100.0f);
|
||||
}
|
||||
|
||||
Destroy(hitbox,5f);
|
||||
|
||||
6
Assets/02_Scripts/Enemy/Skills/SkillPredict.cs
Normal file
6
Assets/02_Scripts/Enemy/Skills/SkillPredict.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class SkillPredict : MonoBehaviour
|
||||
{
|
||||
public ParticleSystem PredictVFX;
|
||||
}
|
||||
2
Assets/02_Scripts/Enemy/Skills/SkillPredict.cs.meta
Normal file
2
Assets/02_Scripts/Enemy/Skills/SkillPredict.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d57b92bb01d0bbf4cb3c27892c5ea5dd
|
||||
@@ -5,19 +5,40 @@ public class SkillSupport : MonoBehaviour
|
||||
[HideInInspector] public Transform[] DownHazardFirePos; // 위에서 아래로 포격
|
||||
[HideInInspector] public Transform[] RightHazardFirePos; // 왼쪽에서 오른쪽으로 포격
|
||||
|
||||
[HideInInspector] public SkillPredict[] DownHazardPredicts;
|
||||
[HideInInspector] public SkillPredict[] RightHazardPredicts;
|
||||
|
||||
void Start()
|
||||
{
|
||||
GameObject[] shineDownStartPoss = GameObject.FindGameObjectsWithTag("ShineDownStartPos");
|
||||
GameObject[] shineRightStartPoss = GameObject.FindGameObjectsWithTag("ShineRightStartPos");
|
||||
|
||||
DownHazardFirePos = new Transform[shineDownStartPoss.Length];
|
||||
DownHazardPredicts = new SkillPredict[shineDownStartPoss.Length];
|
||||
RightHazardFirePos = new Transform[shineRightStartPoss.Length];
|
||||
RightHazardPredicts = new SkillPredict[shineRightStartPoss.Length];
|
||||
|
||||
for(int i=0;i<DownHazardFirePos.Length;i++)
|
||||
{
|
||||
DownHazardFirePos[i] = shineDownStartPoss[i].transform;
|
||||
SkillPredict skillPredict = shineDownStartPoss[i].GetComponentInChildren<SkillPredict>();
|
||||
if(skillPredict != null)
|
||||
{
|
||||
DownHazardPredicts[i] = skillPredict;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
for(int i=0;i<RightHazardFirePos.Length;i++)
|
||||
{
|
||||
RightHazardFirePos[i] = shineRightStartPoss[i].transform;
|
||||
|
||||
|
||||
SkillPredict skillPredict = shineRightStartPoss[i].GetComponentInChildren<SkillPredict>();
|
||||
if(skillPredict != null)
|
||||
{
|
||||
RightHazardPredicts[i] = skillPredict;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user