Prepare for D-Day

This commit is contained in:
Dries Van Schuylenbergh
2023-04-19 23:06:59 +02:00
parent 92c3101db8
commit 7cac7aa9ca
13 changed files with 184 additions and 33 deletions

View File

@@ -380,13 +380,17 @@ public class HangmanController : AbstractFeedback
/// </summary>
private void PickRandomWord()
{
// vvv DEMO DAY STUFF vvv
currentWord = "DEMO DAY";
return;
// ^^^ DEMO DAY STUFF ^^^
// Get a random index for the themes
// Then get a random index for a word to pull
// First get random index for the themes
//int amountThemes = themeList.themes.Count;
//int themeIndex = Random.Range(0, amountThemes);
int themeIndex = 0; // Geography theme
int amountThemes = themeList.themes.Count;
int themeIndex = Random.Range(0, amountThemes);
// Check how many words are in this theme
int amountWords = themeList.themes[themeIndex].learnables.Count;
@@ -520,7 +524,7 @@ public class HangmanController : AbstractFeedback
// The current sign was accepted, return to the game
mode = 2;
if (corrects == currentWord.Length)
if (corrects == currentWord.Replace(" ", "").Length)
{
// Victory, deactivate the model and show the scoreboard
ActivateWin();
@@ -626,7 +630,7 @@ public class HangmanController : AbstractFeedback
/// <param name="word">The word to display</param>
private void DisplayWord(string word)
{
for (int i = 0; i < word.Length; i++)
foreach (Char c in word)
{
// Create instance of prefab
GameObject instance = GameObject.Instantiate(letterPrefab, letterContainer);
@@ -636,7 +640,7 @@ public class HangmanController : AbstractFeedback
Image background = instance.GetComponent<Image>();
background.color = Color.clear;
TMP_Text txt = instance.GetComponentInChildren<TMP_Text>();
txt.text = Char.ToString('_');
txt.text = c == ' ' ? "" : Char.ToString('_');
}
}