sounds and fix junglism staircase
This commit is contained in:
1 parent
3171954d06
commit
1842f1e3da
15 files changed
+309
-953
No files matched your search
Executable
+39
@@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
public enum Sound {
|
||||
MenuLow,
|
||||
MenuHigh,
|
||||
}
|
||||
|
||||
[RequireComponent(typeof(AudioSource))]
|
||||
public class Audio : MonoBehaviour {
|
||||
[SerializeField]
|
||||
Sound[] soundNames;
|
||||
|
||||
[SerializeField]
|
||||
AudioClip[] clips;
|
||||
|
||||
Dictionary<Sound, AudioClip> sounds = new();
|
||||
|
||||
AudioSource source;
|
||||
|
||||
void Start() {
|
||||
source = GetComponent<AudioSource>();
|
||||
|
||||
for (int i = 0; i < clips.Length; i++) {
|
||||
sounds.Add(soundNames[i], clips[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySound(Sound s) {
|
||||
AudioClip clip;
|
||||
bool found = sounds.TryGetValue(s, out clip);
|
||||
if (clip) {
|
||||
source.clip = clip;
|
||||
source.Play(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9bcaa1cfcea9cae4bb92bdc96cfbb4d2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -28,6 +28,9 @@ public class MenuControls : MonoBehaviour {
|
||||
[SerializeField]
|
||||
ControlsUI controlsUI;
|
||||
|
||||
[SerializeField]
|
||||
Audio audio;
|
||||
|
||||
SpaceRaceInput input;
|
||||
|
||||
PlayerData _player;
|
||||
|
||||
Reference in new issue
Block a user