revival/game/Assets/Scripts/Dialogue/DialogueSettings.cs

55 lines
1.6 KiB
C#
Raw Permalink Normal View History

using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
[CreateAssetMenu(menuName = "KernelPanic/Dialogue/Settings")]
public class DialogueSettings : ScriptableObject
{
[Serializable]
public struct InputPromptSpriteIndices
{
public int blink;
public int boost;
public int timeFreeze;
public int interact;
}
public InputPromptSpriteIndices GamepadInputPrompts => _gamepadInputPrompts;
[SerializeField] private InputPromptSpriteIndices _gamepadInputPrompts;
public InputPromptSpriteIndices KeyboardInputPrompts => _keyboardInputPrompts;
[SerializeField] private InputPromptSpriteIndices _keyboardInputPrompts;
public float HideAfter => _hideAfter;
[SerializeField] private float _hideAfter;
public string RadioDialogueKey => _radioDialogueKey;
[SerializeField] private string _radioDialogueKey;
2021-05-14 20:08:27 +02:00
public string BazDialogueKey => _bazDialogueKey;
[SerializeField] private string _bazDialogueKey;
[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;
}
}
}