-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainMenuController.cs
65 lines (57 loc) · 2 KB
/
MainMenuController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class MainMenuController : MonoBehaviour
{
public Text playerName;
public TextMeshProUGUI knightMessage;
public GameObject thunderBg;
public GameObject thunderSound;
public Animator thunderMenu;
public TextMeshProUGUI guessItHighScore;
public TextMeshProUGUI trueOrFalseHighScore;
public TextMeshProUGUI resistHighScore;
public TextMeshProUGUI quizUpHighScore;
public TextMeshProUGUI pawerHighScore;
public InputField answerField;
private DataController dataController;
// Start is called before the first frame update
void Start()
{
dataController = FindObjectOfType<DataController>();
StartCoroutine(ThunderBgAnim());
}
IEnumerator ThunderBgAnim()
{
while (true)
{
yield return new WaitForSeconds(3);
thunderBg.SetActive(true);
thunderSound.SetActive(true);
thunderMenu.SetTrigger("thunder");
yield return new WaitForSeconds(7F);
thunderBg.SetActive(false);
yield return new WaitForSeconds(9);
thunderSound.SetActive(false);
}
}
public void ResetPlayerProgress()
{
dataController.ResetPlayerProgress();
}
public void UpdatePlayerName()
{
dataController.SetUsername(answerField.text);
}
// Update is called once per frame
void Update()
{
knightMessage.text = "Hey, " + dataController.GetPlayerName() + "! Let's defeat those monsters!";
guessItHighScore.text = "LEVEL " + dataController.GetHighestGuessItLevel().ToString();
trueOrFalseHighScore.text = dataController.GetHighestTrueOrFalseScore().ToString();
resistHighScore.text = dataController.GetHighestResistScore().ToString();
quizUpHighScore.text = dataController.GetHighestQuizUpScore().ToString();
pawerHighScore.text = dataController.GetHighestPawerScore().ToString();
}
}