| 
									
										
										
										
											2021-03-05 15:34:52 +00:00
										 |  |  | using System; | 
					
						
							| 
									
										
										
										
											2021-02-19 16:33:02 +00:00
										 |  |  | using System.Collections; | 
					
						
							|  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  | using UnityEngine; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [CreateAssetMenu(menuName = "KernelPanic/Dialogue/Settings")] | 
					
						
							|  |  |  | public class DialogueSettings : ScriptableObject | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     public float HideAfter => _hideAfter; | 
					
						
							| 
									
										
										
										
											2021-02-22 15:29:17 +00:00
										 |  |  |     [SerializeField] private float _hideAfter; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-05 15:34:52 +00:00
										 |  |  |     public string RadioDialogueKey => _radioDialogueKey; | 
					
						
							|  |  |  |     [SerializeField] private string _radioDialogueKey; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     [SerializeField] private AudioClip[] _dialogueClips; | 
					
						
							|  |  |  |     private readonly Dictionary<string, AudioClip> _keyClips = new Dictionary<string, AudioClip>(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public AudioClip GetDialogueClip(string key) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (!_keyClips.ContainsKey(key)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Debug.LogError($"no clip for key {key}"); | 
					
						
							|  |  |  |             return null; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return _keyClips[key]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     private void OnEnable() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         foreach (var dialogueClip in _dialogueClips) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             _keyClips[dialogueClip.name] = dialogueClip; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-02-22 15:29:17 +00:00
										 |  |  | } |