Add SFX and SFX logic

This commit is contained in:
BuyMyMojo 2023-03-03 05:10:23 +11:00
parent f0e4f6c9ba
commit 1aa97baff4
19 changed files with 504 additions and 8 deletions

View file

@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerSounds : MonoBehaviour
{
private Player player;
private float footstepTimer;
private float footstepTimerMax = .1f;
private void Awake()
{
player = GetComponent<Player>();
}
private void Update()
{
footstepTimer -= Time.deltaTime;
if (footstepTimer < 0f )
{
footstepTimer = footstepTimerMax;
if (player.IsWalking())
{
float volume = 1f;
SoundManager.Instance.PlayFootsteps(player.transform.position, volume);
}
}
}
}