-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDayManager.cs
More file actions
74 lines (67 loc) · 2.2 KB
/
Copy pathDayManager.cs
File metadata and controls
74 lines (67 loc) · 2.2 KB
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.SceneManagement;
public class DayManager : MonoBehaviour
{
public int dayNumber;
public TMP_Text dayText;
public int customersThisDay;
public int happinessDecreaseRate;
public bool isDay;
private GameObject player;
public GameObject winPanel;
public GameObject losePanel;
public GameObject laughsPanel;
public GameObject dayPanel;
private bool playerReading;
void Start() {
dayNumber = 0;
isDay = false;
playerReading = false;
player = GameObject.FindGameObjectWithTag("Player");
startNewDay();
}
void Update() {
if (playerReading && Input.GetKeyUp("r")) {
SceneManager.LoadScene("GameScreen");
}
}
public void startNewDay() {
player.transform.position = new Vector3(0.043f, 0, 0);
dayNumber++;
dayText.text = "Day " + dayNumber;
isDay = true;
if (dayNumber == 1) {
customersThisDay = Random.Range(2, 3);
happinessDecreaseRate = Random.Range(5000, 7000);
} else if (dayNumber == 2) {
customersThisDay = Random.Range(3, 4);
happinessDecreaseRate = Random.Range(4000, 6000);
} else if (dayNumber == 3) {
customersThisDay = Random.Range(4, 5);
happinessDecreaseRate = Random.Range(3500, 5500);
} else if (dayNumber == 4) {
customersThisDay = Random.Range(5, 6);
happinessDecreaseRate = Random.Range(3000, 5000);
} else if (dayNumber == 5) {
customersThisDay = Random.Range(6, 7);
happinessDecreaseRate = Random.Range(2750, 4750);
}
}
public void gameLose() {
dayPanel.SetActive(false);
laughsPanel.SetActive(false);
losePanel.SetActive(true);
isDay = false;
playerReading = true;
}
public void gameWin() {
dayPanel.SetActive(false);
laughsPanel.SetActive(false);
winPanel.SetActive(true);
isDay = false;
playerReading = true;
}
}