- changed camera so it only moves on a right click
- added sfx to characters talking - added character sprite to dialogue panel
This commit is contained in:
@@ -16,5 +16,6 @@ public class CharacterData : ScriptableObject
|
||||
[Header("The index of the dialogue relates to what question it should link too.")]
|
||||
public List<Dialogue> m_dialogueOptions;
|
||||
|
||||
public AudioSource m_typingSfx;
|
||||
public AudioClip m_typingSfx;
|
||||
public float m_sfxPitch = 1;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ public class DialoguePanel : MonoBehaviour
|
||||
[SerializeField] private TMP_Text m_characterText;
|
||||
[SerializeField] private CharacterSheetController m_characterSheetController;
|
||||
[SerializeField] private GameObject m_dialogueEndedIndicator;
|
||||
[SerializeField] private AudioSource m_sfxSource;
|
||||
[SerializeField] private Image m_characterImage;
|
||||
|
||||
private const float TypingSpeed = 0.03f;
|
||||
|
||||
@@ -45,6 +47,9 @@ public class DialoguePanel : MonoBehaviour
|
||||
{
|
||||
m_questionIndexAsked.Clear();
|
||||
|
||||
m_characterImage.sprite = characterData.m_avatar;
|
||||
m_sfxSource.pitch = characterData.m_sfxPitch;
|
||||
|
||||
Cleanup();
|
||||
|
||||
if (m_characterSheet != null)
|
||||
@@ -53,6 +58,11 @@ public class DialoguePanel : MonoBehaviour
|
||||
m_characterSheet.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
if (characterData.m_typingSfx != null)
|
||||
{
|
||||
m_sfxSource.clip = characterData.m_typingSfx;
|
||||
}
|
||||
|
||||
m_questionsAsked = 0;
|
||||
m_currentCharacter = characterData;
|
||||
SetCharacterName();
|
||||
@@ -141,6 +151,10 @@ public class DialoguePanel : MonoBehaviour
|
||||
}
|
||||
|
||||
m_characterText.text += letter;
|
||||
|
||||
if (!m_sfxSource.isPlaying)
|
||||
m_sfxSource.Play();
|
||||
|
||||
yield return new WaitForSeconds(TypingSpeed);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user