FootstepsLibrary.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Sirenix.OdinInspector;
  5. namespace KairoEngine.CharacterSystem
  6. {
  7. [CreateAssetMenu(fileName = "footsteps", menuName = "KairoEngine/Footsteps Library", order = 2)]
  8. public class FootstepsLibrary : ScriptableObject
  9. {
  10. [ShowInInspector]
  11. public List<AudioClip> dirtSounds = new List<AudioClip>();
  12. [ShowInInspector]
  13. public List<AudioClip> concreteSounds = new List<AudioClip>();
  14. public List<AudioClip> GetSounds(string key)
  15. {
  16. //Debug.Log(key);
  17. if(key == "Dirt") return dirtSounds;
  18. if(key == "Concrete") return concreteSounds;
  19. else return new List<AudioClip>();
  20. }
  21. public AudioClip GetRandomSound(string key)
  22. {
  23. //Debug.Log(key);
  24. if(key == "Dirt") return dirtSounds[Random.Range(0, dirtSounds.Count)];
  25. if(key == "Concrete") return concreteSounds[Random.Range(0, concreteSounds.Count)];
  26. else return null;
  27. }
  28. }
  29. }