-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tasks.cs
152 lines (137 loc) · 5.66 KB
/
Tasks.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Tasks
{
private List<string> tasks = new List<string>();
private List<string> taskDescriptions = new List<string>();
private List<string> completedTasks = new List<string>();
private string currentTask = "";
private int taskIndex;
private int roomRequired = -1;
private int waveRequired;
private int nextTaskWave;
private GameObject taskInfo;
private Player player;
private string mode;
private int completed;
public Tasks(string mode, GameObject taskInfo, Player player)
{
this.taskInfo = taskInfo;
this.player = player;
int room;
int byWave;
this.mode = mode;
if (mode.Equals("Normal"))
{
room = Random.Range(4, 7);
byWave = 10;
roomRequired = room;
waveRequired = byWave;
tasks = new List<string> { "Room", "Protect", "Light", "Arrow", "Fire", "Poison", "Kill" };
taskDescriptions = new List<string> { "Open the doors to room " + room + " by Wave " + byWave + ". \r\nFailure to complete this task will result in death", "Find and protect the hedgehog for 3 waves. \r\nFailure to complete this task will result in death",
"Find and activate the lever to turn the lights back on", "Kill atleast 5 monsters by using the Arrow Traps (Between room 3 and 5)", "Kill atleast 10 monsters by using Fire Traps (Between room 7 and 8)",
"Kill atleast 15 monsters using Poison Traps (Between room 8 and 9)", "Find and kill the Spectral. Your Oxygen will drain faster the longer you keep it alive"};
} else if (mode.Equals("Hard"))
{
room = Random.Range(7, 10);
byWave = 9;
roomRequired = room;
waveRequired = byWave;
tasks = new List<string> { "Room", "Protect", "Light", "Arrow", "Fire", "Poison", "Kill" };
taskDescriptions = new List<string> { "Open the doors to room " + room + " by Wave " + byWave + ". \r\nFailure to complete this task will result in death", "Find and protect the hedgehog for 5 waves. \r\nFailure to complete this task will result in death",
"Find and activate the lever to turn the lights back on", "Kill atleast 10 monsters by using the Arrow Traps (Between room 3 and 4)", "Kill atleast 15 monsters by using Fire Traps (Between room 7 and 8)",
"Kill atleast 20 monsters using Poison Traps (Between room 10 and 11)", "Find and kill the Spectral. Your Oxygen will drain faster the longer you keep it alive"};
} else if (mode.Equals("Expert"))
{
room = Random.Range(9, 12);
byWave = 8;
roomRequired = room;
waveRequired = byWave;
tasks = new List<string> { "Room", "Protect", "Light", "Arrow", "Fire", "Poison", "Kill" };
taskDescriptions = new List<string> { "Open the doors to room " + room + " by Wave " + byWave + ".\r\nFailure to complete this task will result in death", "Find and protect the hedgehog for 7 waves. \r\nFailure to complete this task will result in death",
"Find and activate the lever to turn the lights back on", "Kill atleast 15 monsters by using the Arrow Traps (Between room 4 and 5)", "Kill atleast 20 monsters by using Fire Traps (Between room 7 and 8)",
"Kill atleast 25 monsters using Poison Traps (Between room 9 and 10)", "Find and kill the Spectral. Your Oxygen will drain faster the longer you keep it alive"};
}
if (Player.testing)
{
taskDescriptions.RemoveRange(0, 6);
tasks.RemoveRange(0, 6);
waveRequired = -1;
nextTaskWave = 46;
}
}
public void AutoStartTask()
{
taskIndex = 0;
currentTask = tasks[taskIndex];
tasks.RemoveAt(taskIndex);
taskInfo.GetComponent<Text>().text = "Task Received! Press T to view it.";
taskInfo.GetComponent<Animator>().enabled = true;
}
public void RandomizeTask()
{
taskIndex = 0;
currentTask = tasks[taskIndex];
taskInfo.GetComponent<Text>().text = "Task Received! Press T to View it.";
taskInfo.GetComponent<Animator>().enabled = true;
if (currentTask.Equals("Protect"))
{
if (mode.Equals("Normal"))
{
waveRequired = nextTaskWave + 3;
} else if (mode.Equals("Hard"))
{
waveRequired = nextTaskWave + 5;
} else if (mode.Equals("Expert"))
{
waveRequired = nextTaskWave + 7;
}
}
}
public void CompleteTask(int currentWave)
{
taskInfo.GetComponent<Animator>().enabled = false;
player.TaskMessage("You have successfully completed your task.", 8);
completedTasks.Add(currentTask);
tasks.Remove(currentTask);
taskDescriptions.RemoveAt(taskIndex);
waveRequired = -1;
nextTaskWave = currentWave + 5;
currentTask = "";
completed++;
}
public bool HasTask()
{
return currentTask.Length != 0;
}
public string GetCurrentTask()
{
return currentTask;
}
public string GetTaskDescription()
{
return taskDescriptions[taskIndex];
}
public int GetTaskIndex()
{
return taskIndex;
}
public int GetRoomRequired()
{
return roomRequired;
}
public int GetWaveRequired()
{
return waveRequired;
}
public int GetNextTaskWave()
{
return nextTaskWave;
}
public int GetTaskCompleted()
{
return completed;
}
}