Есть классы, есть двери, есть механика вселения, свага есть
This commit is contained in:
1 parent
2ae795c30a
commit
0f9a539460
69 files changed
+3960
-299
No files matched your search
@@ -17,25 +17,25 @@ namespace _Project.Scripts.PlayerUtils
|
||||
[Header("Звуки Оружия")]
|
||||
[SerializeField] private AudioClip shootSound;
|
||||
|
||||
private float _baseFootstepPitch = 1f;
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
// Автоматически подцепит AudioSource при добавлении скрипта на объект
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
}
|
||||
|
||||
public void SetFootstepPitch(float pitch) => _baseFootstepPitch = pitch;
|
||||
|
||||
public void PlayFootstep(bool isSprinting)
|
||||
{
|
||||
if (footstepSounds == null || footstepSounds.Length == 0) return;
|
||||
|
||||
int randomIndex = Random.Range(0, footstepSounds.Length);
|
||||
|
||||
// Немного меняем высоту звука для разнообразия
|
||||
audioSource.pitch = Random.Range(0.9f, 1.1f);
|
||||
audioSource.pitch = _baseFootstepPitch * Random.Range(0.92f, 1.08f);
|
||||
|
||||
float volume = isSprinting ? 0.6f : 0.4f;
|
||||
audioSource.PlayOneShot(footstepSounds[randomIndex], volume);
|
||||
|
||||
audioSource.pitch = 1f; // Сбрасываем питч обратно
|
||||
audioSource.pitch = 1f;
|
||||
}
|
||||
|
||||
public void PlayJump()
|
||||
|
||||
Reference in new issue
Block a user