A game about forced loneliness, made by TACStudios
1using System;
2using System.Collections;
3using TMPro;
4using UnityEngine;
5using UnityEngine.UI;
6
7public class ProgressTracker : MonoBehaviour
8{
9 public PlayerStats player;
10 public GameObject tableSecond;
11 public GameObject bedSecond;
12 public GameObject bedThird;
13 public int interactedWithToday;
14
15 public bool gotFood = false;
16 public bool interactedWithTable = false;
17 public bool interactedWithBed = false;
18
19 public bool hasInteractedWithDay2Wall = false;
20
21 public string playerName;
22
23 public bool dayHasEnded = false;
24
25 public TMP_InputField nameInputField;
26 public GameObject nameInputPanel;
27 public TMP_Text playerNameText;
28
29 public string[] wallAfterNameTexts;
30 public InteractableText wallInteractablle;
31
32 public bool interactedWithDay4Food;
33
34 public bool foodYes;
35 public bool knifeYes;
36
37 public bool drown;
38
39
40 private void Start()
41 {
42 DontDestroyOnLoad(this);
43 }
44
45 private void Update()
46 {
47 switch (player.dayNumber)
48 {
49 case 1:
50 if (interactedWithToday == 8)
51 {
52 bedSecond.SetActive(false);
53 bedThird.SetActive(true);
54 }
55 else if (interactedWithToday == 9)
56 {
57
58 interactedWithToday = 0;
59 dayHasEnded = true;
60 }
61 break;
62 case 2:
63 if (interactedWithToday == 8)
64 {
65 bedSecond.SetActive(false);
66 bedThird.SetActive(true);
67 }
68 else if (interactedWithToday == 9)
69 {
70 interactedWithToday = 0;
71 dayHasEnded = true;
72 }
73 break;
74 case 3:
75 if (interactedWithToday == 8)
76 {
77 bedSecond.SetActive(false);
78 bedThird.SetActive(true);
79 }
80 else if (interactedWithToday == 9)
81 {
82 interactedWithToday = 0;
83 dayHasEnded = true;
84 }
85 break;
86 }
87
88 if (interactedWithTable && gotFood)
89 {
90 tableSecond.SetActive(true);
91 interactedWithTable = false;
92 gotFood = false;
93 }
94
95 if (interactedWithBed && interactedWithToday != 8)
96 {
97 bedSecond.SetActive(true);
98 interactedWithBed = false;
99 }
100 }
101
102
103 public void SetName()
104 {
105 StartCoroutine(NameInputRoutine());
106 }
107
108 private IEnumerator NameInputRoutine()
109 {
110 nameInputPanel.SetActive(true);
111 nameInputField.text = "";
112 nameInputField.characterLimit = 5;
113 nameInputField.ActivateInputField();
114
115 bool nameSet = false;
116 while (!nameSet)
117 {
118 if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
119 {
120 string inputName = nameInputField.text;
121 if (!string.IsNullOrEmpty(inputName))
122 {
123 playerName = inputName;
124 nameSet = true;
125 }
126 }
127 yield return null;
128 }
129
130 nameInputPanel.SetActive(false);
131 playerNameText.text = playerName;
132 wallAfterNameTexts[0] = playerName + "!";
133 wallInteractablle.ShowDialogue(wallAfterNameTexts);
134 }
135}