-
Notifications
You must be signed in to change notification settings - Fork 0
/
RecieverData.cs
71 lines (59 loc) · 1.87 KB
/
RecieverData.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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
// Script that holds reciever functionality and level clear conditions
public class RecieverData : MonoBehaviour
{
public int requiredNum;
public Text levelCompleteText;
public Animation anim;
public GameManagerBehavior gameManagerBehavior;
public Text recieverText;
bool borderEnableFlag = false;
public List<GameObject> borderList = new List<GameObject>();
void Start()
{
recieverText.text = "Goal: " + requiredNum;
levelCompleteText.enabled = false;
}
// Function used for level completion check
public void checkCompletion(int num){
if(requiredNum == num){
print("Level Complete!");
levelCompleteText.enabled = true;
Animation animation = levelCompleteText.GetComponent<Animation>();
animation.Play();
CoreData[] cores = FindObjectsOfType<CoreData>();
foreach(CoreData core in cores){
core.resetColors();
}
Invoke("finishLevel", 2f);
}
else{
print("Level Failed.");
}
}
// Tells game manager to move to next level
void finishLevel(){
gameManagerBehavior.loadNextLevel();
}
void Update(){
if(Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.RightShift)){
//clearGizmos();
}
}
// Clears borders (not used)
public void clearGizmos(){
foreach(GameObject gm in borderList){
gm.SetActive(borderEnableFlag);
if(borderEnableFlag)
borderEnableFlag = false;
else
borderEnableFlag = true;
}
}
public void receiverMenu(){
gameManagerBehavior.loadInstructionsMainMenu();
}
}