add doug to dialogue, start grandma quest
This commit is contained in:
@@ -6,6 +6,15 @@ public class Dialogue
|
||||
public string charName;
|
||||
public bool isActive = false;
|
||||
|
||||
[TextArea(3,10)]
|
||||
public string[] sentences;
|
||||
public DialogueLine[] sentences;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class DialogueLine
|
||||
{
|
||||
// is Doug or the character talking? Let's convo have 2 sides
|
||||
public bool isDoug;
|
||||
|
||||
[TextArea(3, 10)]
|
||||
public string line;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
public class DialogueManager : MonoBehaviour
|
||||
{
|
||||
private Queue<string> sentences;
|
||||
private Queue<DialogueLine> sentences;
|
||||
private Dialogue currentDialogue;
|
||||
private DialogueVoice currentDialogueVoice;
|
||||
private float maxDialogueWaitTime = 1.0f;
|
||||
@@ -25,7 +25,7 @@ public class DialogueManager : MonoBehaviour
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
sentences = new Queue<string>();
|
||||
sentences = new Queue<DialogueLine>();
|
||||
voiceSourcePool = GetComponentsInChildren<AudioSource>();
|
||||
}
|
||||
|
||||
@@ -45,9 +45,8 @@ public void StartDialogue(Dialogue dialogue, DialogueVoice dialogueVoice)
|
||||
sentences.Clear();
|
||||
currentDialogue = dialogue;
|
||||
currentDialogueVoice = dialogueVoice;
|
||||
nameText.text = dialogue.charName;
|
||||
|
||||
foreach (string sentence in dialogue.sentences)
|
||||
foreach (DialogueLine sentence in dialogue.sentences)
|
||||
{
|
||||
sentences.Enqueue(sentence);
|
||||
}
|
||||
@@ -64,7 +63,7 @@ public void DisplayNextSentence()
|
||||
return;
|
||||
}
|
||||
|
||||
string sentence = sentences.Dequeue();
|
||||
DialogueLine sentence = sentences.Dequeue();
|
||||
StopAllCoroutines();
|
||||
StopVoices();
|
||||
StartCoroutine(TypeSentence(sentence));
|
||||
@@ -82,34 +81,51 @@ public void EndDialogue()
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator TypeSentence(string sentence)
|
||||
IEnumerator TypeSentence(DialogueLine sentence)
|
||||
{
|
||||
dialogueText.text = "";
|
||||
char[] sentenceCharArray = sentence.ToCharArray();
|
||||
|
||||
if (sentence.isDoug)
|
||||
{
|
||||
nameText.text = "Doug";
|
||||
}
|
||||
else
|
||||
{
|
||||
nameText.text = currentDialogue.charName;
|
||||
}
|
||||
|
||||
char[] sentenceCharArray = sentence.line.ToCharArray();
|
||||
for (int i = 0; i < sentenceCharArray.Length; i++)
|
||||
{
|
||||
dialogueText.text += sentenceCharArray[i];
|
||||
|
||||
if (currentDialogueVoice != null && currentDialogueVoice.voice != Voices.None)
|
||||
if (sentence.isDoug)
|
||||
{
|
||||
if (i % currentDialogueVoice.speechInterval == 0)
|
||||
{
|
||||
AudioClip voiceToPlay = currentDialogueVoice.GetClipFromChar(char.ToLower(sentenceCharArray[i]));
|
||||
|
||||
if (voiceToPlay != null)
|
||||
{
|
||||
PlayNextClip(voiceToPlay);
|
||||
}
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(maxDialogueWaitTime - currentDialogueVoice.talkSpeed * maxDialogueWaitTime);
|
||||
// TODO: Add Doug voice
|
||||
yield return new WaitForSeconds(0.03f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Add speed variable to non-voices (Talkable.cs)
|
||||
yield return new WaitForSeconds(0.03f);
|
||||
if (currentDialogueVoice != null && currentDialogueVoice.voice != Voices.None)
|
||||
{
|
||||
if (i % currentDialogueVoice.speechInterval == 0)
|
||||
{
|
||||
AudioClip voiceToPlay = currentDialogueVoice.GetClipFromChar(char.ToLower(sentenceCharArray[i]));
|
||||
|
||||
if (voiceToPlay != null)
|
||||
{
|
||||
PlayNextClip(voiceToPlay);
|
||||
}
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(maxDialogueWaitTime - currentDialogueVoice.talkSpeed * maxDialogueWaitTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Add speed variable to non-voices (Talkable.cs)
|
||||
yield return new WaitForSeconds(0.03f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -135,10 +135,7 @@ void ApplyGravity()
|
||||
else
|
||||
moveDir *= walkSpeed;
|
||||
|
||||
if (!characterController.isGrounded)
|
||||
{
|
||||
moveDir.y = -gravity;
|
||||
}
|
||||
moveDir.y += -gravity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -5,9 +5,9 @@ public class Quest : MonoBehaviour
|
||||
public bool hasStarted = false;
|
||||
public bool hasCompleted = false;
|
||||
|
||||
public string[] askText; // ask the player to complete the task
|
||||
public string[] duringText; // what to say to the player when the task is complete
|
||||
public string[] completionText; // what to say to the player upon completion
|
||||
public DialogueLine[] askText; // ask the player to complete the task
|
||||
public DialogueLine[] duringText; // what to say to the player when the task is complete
|
||||
public DialogueLine[] completionText; // what to say to the player upon completion
|
||||
|
||||
public int questID = 0; // connects the quest to the registry, which gives us conditions
|
||||
|
||||
|
||||
@@ -53,6 +53,36 @@ private void Awake()
|
||||
questBoolMap.Add(1, QID1_List);
|
||||
#endregion
|
||||
|
||||
#region 2 - (Story Quest #1) No More Freeloading
|
||||
// This is the first time we talk to grandma. She wants help around the house.
|
||||
// Quest is complete after we talk to the shop keeper and complete quest 3.
|
||||
|
||||
QuestBool[] QID2_List = new QuestBool[1];
|
||||
|
||||
// QID2_1_completedQuest3
|
||||
QID1_List[0] = new QuestBool(() =>
|
||||
{
|
||||
return CompletedQuests.Contains(3);
|
||||
});
|
||||
|
||||
questBoolMap.Add(2, QID1_List);
|
||||
#endregion
|
||||
|
||||
#region 3 - (Story Quest #1.5) First Paycheck
|
||||
// This is the first time we talk to the shopkeeper. He tells us to find a star
|
||||
// shard and bring it to him.
|
||||
|
||||
QuestBool[] QID3_List = new QuestBool[1];
|
||||
|
||||
// QID3_1_hasEnoughStarshards
|
||||
QID1_List[0] = new QuestBool(() =>
|
||||
{
|
||||
return GameManager.Instance.Inventory.GetItemQuantity(ItemIdEnum.STAR_SHARD) > 0;
|
||||
});
|
||||
|
||||
questBoolMap.Add(3, QID1_List);
|
||||
#endregion
|
||||
|
||||
return questBoolMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,4 +7,8 @@ public class Storybools
|
||||
#region QID1
|
||||
public bool hasHelpedSam = false;
|
||||
#endregion
|
||||
|
||||
#region QID3
|
||||
public bool talkedToShopkeep = false;
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Ballgun : Tool
|
||||
{
|
||||
[Header("Ball Gun Parameters")]
|
||||
public float shootForce = 10;
|
||||
public GameObject ball;
|
||||
public float ballLifeTime = 5;
|
||||
|
||||
public override void Use()
|
||||
{
|
||||
GameObject newBall = Instantiate(ball);
|
||||
newBall.transform.position = transform.position;
|
||||
|
||||
Vector3 direction = transform.forward * shootForce;
|
||||
direction += GameManager.Instance.GetPlayerController().GetVelocity();
|
||||
|
||||
newBall.GetComponent<Rigidbody>().AddForce(direction, ForceMode.Impulse);
|
||||
|
||||
Destroy(newBall, ballLifeTime);
|
||||
}
|
||||
|
||||
public override void UseAlt()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8adaf1de0b489444189e21893ccde9b5
|
||||
Reference in New Issue
Block a user