Setup test character and triggered dialogue
This will need adjusting to work with the click/input
This commit is contained in:
8
Assets/Data.meta
Normal file
8
Assets/Data.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72bd0343ae503704c804354c27d429a8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
29
Assets/Data/Derk.asset
Normal file
29
Assets/Data/Derk.asset
Normal file
@@ -0,0 +1,29 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ddda90cbbcf3ea54e9105c3a5f0ac9a5, type: 3}
|
||||
m_Name: Derk
|
||||
m_EditorClassIdentifier:
|
||||
m_name: Derk
|
||||
m_charisma: 5
|
||||
m_strength: 5
|
||||
m_dexterity: 3
|
||||
m_intelligence: 5
|
||||
m_money: 5
|
||||
m_dialogueOptions:
|
||||
- text: "Name\u2019s Derk"
|
||||
- text: "Man, I just want to work, y\u2019know? Give me a task and I\u2019ll do
|
||||
it, no problem for old Derk."
|
||||
- text: "This mornin\u2019 I helped an old lady get into one of those high speed
|
||||
trains. They always say Derk the jerk, but no one ever says \u201CWow, what
|
||||
a nice guy\u201D. "
|
||||
- text: "\u2026 (drools)"
|
||||
- text: I just want money, whatevs
|
||||
8
Assets/Data/Derk.asset.meta
Normal file
8
Assets/Data/Derk.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe5c0edf44ede8146ac344d9538dafc6
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -5,10 +5,16 @@ using UnityEngine;
|
||||
public class DialogueController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private DialoguePanel m_dialoguePanel;
|
||||
[SerializeField] private List<CharacterData> m_characterDatas;
|
||||
|
||||
// TODO:
|
||||
// - Load the correct character based on the character who has been interacted with
|
||||
// - Display the 5 question options and hook up their responses
|
||||
// - Fill out a character sheet as you go along
|
||||
// - Update the visual with the text
|
||||
// DEBUG - Will need replacing with the character you selected.
|
||||
private void Start()
|
||||
{
|
||||
DisplayCharacterText(m_characterDatas[0]);
|
||||
}
|
||||
|
||||
public void DisplayCharacterText(CharacterData character)
|
||||
{
|
||||
m_dialoguePanel.Setup(character);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,16 +12,18 @@ public class DialoguePanel : MonoBehaviour
|
||||
[SerializeField] private TMP_Text m_characterNameText;
|
||||
[SerializeField] private TMP_Text m_characterText;
|
||||
|
||||
private const float TypingSpeed = 0.02f;
|
||||
private const float TypingSpeed = 0.03f;
|
||||
|
||||
private CharacterData m_currentCharacter;
|
||||
private bool m_skipped = false;
|
||||
|
||||
private void Start()
|
||||
private void Awake()
|
||||
{
|
||||
PopulateQuestionButtons();
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// Sets the reference to the characterData to use.
|
||||
public void Setup(CharacterData characterData)
|
||||
{
|
||||
Cleanup();
|
||||
@@ -31,8 +33,11 @@ public class DialoguePanel : MonoBehaviour
|
||||
|
||||
// TODO: will this be changed with an introductory text?
|
||||
m_characterText.text = "Select an option...";
|
||||
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
// Handles cleaing up for the next text.
|
||||
private void Cleanup()
|
||||
{
|
||||
m_skipped = false;
|
||||
@@ -53,7 +58,11 @@ public class DialoguePanel : MonoBehaviour
|
||||
buttonText.text = QuestionData.Questions[i];
|
||||
|
||||
var button = buttonObj.GetComponent<Button>();
|
||||
button.onClick.AddListener(() => OnQuestionButtonClicked(i));
|
||||
|
||||
var index = i;
|
||||
button.onClick.AddListener(() => OnQuestionButtonClicked(index));
|
||||
|
||||
button.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +92,7 @@ public class DialoguePanel : MonoBehaviour
|
||||
// Handles displaying the correct dialogue for the question.
|
||||
private void OnQuestionButtonClicked(int index)
|
||||
{
|
||||
Debug.Log("Player picked option " + index);
|
||||
//Debug.Log("Player picked option " + index);
|
||||
|
||||
Cleanup();
|
||||
|
||||
@@ -92,4 +101,10 @@ public class DialoguePanel : MonoBehaviour
|
||||
|
||||
// TODO: we should update the sheet with this information.
|
||||
}
|
||||
|
||||
// Callback from Unity on the skip button.
|
||||
public void Action_SkipButtonClicked()
|
||||
{
|
||||
m_skipped = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user