2026-06-02 사운드 추가
This commit is contained in:
@@ -28,6 +28,10 @@ public abstract class BossSkill : MonoBehaviour
|
||||
[SerializeField] private float _cooldown = 8f; // 재사용 대기 (타이머는 BossAI가 보스별로 추적)
|
||||
[SerializeField] private string _casterAnimationState = "BossCast"; // 시전 중 보스가 재생할 애니메이션
|
||||
|
||||
[Header("Audio")]
|
||||
[SerializeField] private AudioClip _castSound; // 시전(발동) 사운드. 명중 여부와 무관하게 스킬 시작 시 항상 재생 (null이면 없음)
|
||||
[SerializeField, Range(0f, 1f)] private float _castSoundVolume = 1f; // 시전 사운드 볼륨
|
||||
|
||||
public int MinPhase => _minPhase;
|
||||
public float Range => _range;
|
||||
public float Cooldown => _cooldown;
|
||||
@@ -37,6 +41,8 @@ public abstract class BossSkill : MonoBehaviour
|
||||
// destroyCancellationToken: BossAI가 이 인스턴스를 Destroy하면 시퀀스가 취소된다.
|
||||
public async void Begin()
|
||||
{
|
||||
PlayCastSound();
|
||||
|
||||
try
|
||||
{
|
||||
await RunSkill(destroyCancellationToken);
|
||||
@@ -47,12 +53,20 @@ public async void Begin()
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogException(e, this); // 스킬 버그가 나도 아래 Destroy로 정리는 보장
|
||||
|
||||
}
|
||||
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
// 시전(발동) 사운드 재생. 명중 여부와 무관하게 스킬 시작 시 항상 1회 재생.
|
||||
// AudioManager의 SFX 풀을 통해 믹서로 라우팅된다.
|
||||
private void PlayCastSound()
|
||||
{
|
||||
if (_castSound == null || AudioManager.Instance == null) return;
|
||||
AudioManager.Instance.PlaySfx(_castSound, _castSoundVolume);
|
||||
}
|
||||
|
||||
// 서브클래스가 실제 스킬 시퀀스를 구현. token이 취소되면 finally에서 정리할 것.
|
||||
protected abstract Awaitable RunSkill(CancellationToken token);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user