32 lines
938 B
C#
32 lines
938 B
C#
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class PlayerSound : MonoBehaviour
|
||
|
{
|
||
|
private List<AudioClip> _hitClips;
|
||
|
private List<AudioClip> _wooshClips;
|
||
|
private List<AudioClip> _footStepSounds;
|
||
|
|
||
|
public void initalize(List<AudioClip> hitClips, List<AudioClip> wooshClips, List<AudioClip> footStepSounds)
|
||
|
{
|
||
|
_hitClips = hitClips;
|
||
|
_wooshClips = wooshClips;
|
||
|
_footStepSounds = footStepSounds;
|
||
|
}
|
||
|
|
||
|
public void playHitSound()
|
||
|
{
|
||
|
AudioSource.PlayClipAtPoint(_hitClips[Random.Range(0, _hitClips.Count)], transform.position, 0.25f);
|
||
|
}
|
||
|
|
||
|
public void playWooshSound()
|
||
|
{
|
||
|
AudioSource.PlayClipAtPoint(_wooshClips[Random.Range(0, _wooshClips.Count)], transform.position, 0.25f);
|
||
|
}
|
||
|
|
||
|
public void playFootStepSound()
|
||
|
{
|
||
|
AudioSource.PlayClipAtPoint(_footStepSounds[Random.Range(0, _footStepSounds.Count)], transform.position, 1f);
|
||
|
}
|
||
|
}
|