using UnityEngine;
///
/// Ç÷¹À̾îÀÇ ½Ã°¢(VFX) ¹× û°¢(SFX) È¿°ú¸¦ Àü´ãÇÏ´Â ½ºÅ©¸³Æ®
///
public class PlayerEffects : MonoBehaviour
{
[Header("--- ½Ã°¢ È¿°ú (VFX) ---")]
[SerializeField] private GameObject[] slashEffects; // ÄÞº¸º° ´Ù¸¥ ÀÌÆåÆ® °¡´É
[SerializeField] private Transform slashSpawnPoint;
[Header("--- û°¢ È¿°ú (SFX) ---")]
[SerializeField] private AudioClip[] swingSounds;
private AudioSource _audioSource;
private void Awake()
{
_audioSource = GetComponent();
if (_audioSource == null) _audioSource = gameObject.AddComponent();
}
///
/// ¾Ö´Ï¸ÞÀÌ¼Ç À̺¥Æ®¿¡¼ È£ÃâÇÒ ÇÔ¼ö
///
/// ÇöÀç °ø°Ý ÄÞº¸ ¹øÈ£ (0~2)
public void PlaySlashEffect(int comboIndex)
{
// 1. »ç¿îµå Àç»ý
if (swingSounds.Length > comboIndex && swingSounds[comboIndex] != null)
{
_audioSource.PlayOneShot(swingSounds[comboIndex]);
}
// 2. ÀÌÆåÆ® »ý¼º
if (slashEffects.Length > comboIndex && slashEffects[comboIndex] != null && slashSpawnPoint != null)
{
GameObject slash = Instantiate(slashEffects[comboIndex], slashSpawnPoint.position, slashSpawnPoint.rotation);
Destroy(slash, 1.0f);
}
}
}