mirror of
https://github.com/ryzij/Cube-Tower-Defense.git
synced 2026-07-14 01:56:57 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private AudioSource[] _grassBlockDestroySound;
|
||||
private int _grassSoundIndex = 0;
|
||||
|
||||
public void PlayBlockDestroySound(BlockScript block)
|
||||
{
|
||||
switch (block.Type)
|
||||
{
|
||||
case BlockScript.BlockType.Grass:
|
||||
case BlockScript.BlockType.PathFinish:
|
||||
if (_grassBlockDestroySound == null)
|
||||
return;
|
||||
|
||||
_grassBlockDestroySound[_grassSoundIndex].Play();
|
||||
_grassSoundIndex = (_grassSoundIndex + 1) % _grassBlockDestroySound.Length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user