"...git@gitup.uni-potsdam.de:daschmidt/ModSim_Uebungen.git" did not exist on "9143036246c3136736bfbe31f99f65f3d5bd9d89"
Newer
Older
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
66
67
68
69
70
71
72
73
74
75
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class EmployeeInteraction : MonoBehaviour
{
public GameObject employeePanel;
public TextMeshProUGUI employeeIDText;
public TextMeshProUGUI questionText;
public Button questionButton;
public Button yesButton;
public Button noButton;
public Color correctAnswerColor = Color.green; // Farbe fr die richtige Antwort
private void Start()
{
employeePanel.SetActive(false); // Verstecke das Panel beim Start
yesButton.gameObject.SetActive(false); // Verstecke JA Button
noButton.gameObject.SetActive(false); // Verstecke NEIN Button
questionText.gameObject.SetActive(false); // Verstecke die Frage
}
private void OnMouseDown()
{
ShowEmployeeID();
}
private void ShowEmployeeID()
{
employeePanel.SetActive(true);
employeeIDText.text = "Mitarbeiter ID: 12345"; // Beispielhafte ID
questionButton.gameObject.SetActive(true);
questionButton.onClick.RemoveAllListeners();
questionButton.onClick.AddListener(() => ShowQuestion());
}
private void ShowQuestion()
{
employeeIDText.text = "Mitarbeiter ID: 12345";
questionText.text = "Jeder Mitarbeiter muss stets zu jeder Arbeitszeit die Mitarbeiter ID tragen";
questionText.gameObject.SetActive(true);
questionButton.gameObject.SetActive(false); // Verstecke den Frage Button
yesButton.gameObject.SetActive(true); // Zeige JA Button
noButton.gameObject.SetActive(true); // Zeige NEIN Button
yesButton.onClick.RemoveAllListeners();
noButton.onClick.RemoveAllListeners();
yesButton.onClick.AddListener(() => OnYesButtonClicked());
noButton.onClick.AddListener(() => OnNoButtonClicked());
}
private void OnYesButtonClicked()
{
Debug.Log("Ja Button geklickt");
yesButton.GetComponent<Image>().color = correctAnswerColor; // Markiere JA Button grn
// Optional: Zeige eine Nachricht an oder fhre eine weitere Aktion aus
}
private void OnNoButtonClicked()
{
Debug.Log("Nein Button geklickt");
employeePanel.SetActive(false); // Verstecke das Panel oder fhre andere Aktionen aus
ResetUI();
}
private void ResetUI()
{
questionButton.gameObject.SetActive(true); // Zeige den Frage Button
questionText.gameObject.SetActive(false); // Verstecke die Frage
yesButton.gameObject.SetActive(false); // Verstecke JA Button
noButton.gameObject.SetActive(false); // Verstecke NEIN Button
yesButton.GetComponent<Image>().color = Color.white; // Setze die Farbe des JA Buttons zurck
}
}