Add SFX to dialogue, revamp control scheme (broken world map camera)
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Scampz.GameJam
|
||||
{
|
||||
public class AudioPlayer : MonoBehaviour
|
||||
{
|
||||
}
|
||||
}
|
||||
9
Assets/Scripts/Audio/SFX.cs
Normal file
9
Assets/Scripts/Audio/SFX.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts.Audio
|
||||
{
|
||||
public class SFX : MonoBehaviour
|
||||
{
|
||||
public AudioClip[] SoundEffects;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0929d89c738f7434a8aeb4a3142ae89d
|
||||
guid: d4470fbab6987df4baea8aa8b9b42f6b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
64
Assets/Scripts/Audio/SFXManager.cs
Normal file
64
Assets/Scripts/Audio/SFXManager.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts.Audio
|
||||
{
|
||||
public class SFXManager : MonoBehaviour
|
||||
{
|
||||
public static SFXManager Instance;
|
||||
|
||||
[SerializeField]
|
||||
private SFX _soundEffects;
|
||||
[SerializeField]
|
||||
private AudioSource _audioSource;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null && Instance != this)
|
||||
{
|
||||
Destroy(this);
|
||||
return;
|
||||
}
|
||||
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public void PlaySoundEffect(string soundEffect)
|
||||
{
|
||||
var audioClip = GetClipFromName(soundEffect);
|
||||
_audioSource.PlayOneShot(audioClip);
|
||||
}
|
||||
|
||||
public void StopSoundEffect()
|
||||
{
|
||||
_audioSource.Stop();
|
||||
}
|
||||
|
||||
|
||||
private AudioClip GetClipFromName(string desiredSoundEffect)
|
||||
=> _soundEffects.SoundEffects.Where(x => x.name.Equals(desiredSoundEffect)).Single();
|
||||
}
|
||||
|
||||
public class SoundEffect
|
||||
{
|
||||
public static string ComputerTalk => "computer talk ed";
|
||||
|
||||
public static string Diety => "diety";
|
||||
|
||||
public static string LavaGuy => "lava guy ed";
|
||||
|
||||
public static string MenuUpDown => "menu up down";
|
||||
|
||||
public static string Narration => "narration";
|
||||
|
||||
public static string Ok => "ok";
|
||||
|
||||
public static string SandStep => "sand step ed";
|
||||
|
||||
public static string SnowStep => "snow step";
|
||||
|
||||
public static string TempleStep => "temple step ed";
|
||||
|
||||
public static string GrassStep => "grass step ed";
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Audio/SFXManager.cs.meta
Normal file
11
Assets/Scripts/Audio/SFXManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1081614305b95943acf23b2a69bbc20
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user