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);
|
||||
|
||||
Reference in New Issue
Block a user