riversong code showcase

This commit is contained in:
Daniele Marotta
2026-05-21 15:52:18 +02:00
commit 4c9eea1c02
462 changed files with 23406 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
using Unity.Mathematics;
using UnityEngine.Audio;
namespace DanieleMarotta.RiversongCodeShowcase
{
public interface ISoundPlayer
{
void Play(AudioResource resource);
void PlayAt(AudioResource resource, float3 position);
void PlayAt(AudioResource resource, int2 tile);
AudioResource GetSystemSound(SystemSoundId soundId);
}
public static class SoundPlayerExtensions
{
public static void Play(this ISoundPlayer soundPlayer, SystemSoundId soundId)
{
soundPlayer.Play(soundPlayer.GetSystemSound(soundId));
}
public static void PlayAt(this ISoundPlayer soundPlayer, SystemSoundId soundId, float3 position)
{
soundPlayer.PlayAt(soundPlayer.GetSystemSound(soundId), position);
}
public static void PlayAt(this ISoundPlayer soundPlayer, SystemSoundId soundId, int2 tile)
{
soundPlayer.PlayAt(soundPlayer.GetSystemSound(soundId), tile);
}
}
}