-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCommsCenterAccess.cs
More file actions
148 lines (138 loc) · 7.51 KB
/
CommsCenterAccess.cs
File metadata and controls
148 lines (138 loc) · 7.51 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
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
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityEngine.SceneManagement;
public class CommsCenterAccess : MonoBehaviour {
public AudioSource swipe;
public AudioSource door;
public GameObject player;
private Text pickupText;
public bool atDoor;
// Use this for initialization
void Start () {
door = gameObject.GetComponent<AudioSource> ();
swipe = GameObject.Find ("SwipeSound").GetComponent<AudioSource> ();
player = GameObject.FindWithTag ("Player");
atDoor = false;
pickupText = GameObject.Find ("ManualPickup").GetComponent<Text> ();
pickupText.text = "";
}
void Update()
{
if (Input.GetKeyDown (KeyCode.E) && player.GetComponent<PlayerController> ().activeHint == false && player.GetComponent<PlayerController> ().activeTab == false && player.GetComponent<PlayerController> ().finishedJump == true && atDoor == true) {
if (player.GetComponent<PlayerController> ().hasSuit == false) {
player.GetComponent<PlayerController> ().playerAnimator.Play ("StellaStand");
}
else {
player.GetComponent<PlayerController> ().playerAnimator.Play ("SpaceStand");
}
StartCoroutine ("commsDoorOpen");
}
}
void OnTriggerEnter2D (Collider2D col)
{
pickupText.text = "Press 'E' to Enter";
atDoor = true;
}
void OnTriggerExit2D (Collider2D col)
{
pickupText.text = "";
atDoor = false;
}
public IEnumerator commsDoorOpen ()
{
player.GetComponent<PlayerController> ().activeHint = true;
player.GetComponent<PlayerController> ().activeTab = true;
player.GetComponent<PlayerController> ().canMove = false;
player.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezePosition | RigidbodyConstraints2D.FreezeRotation;
if (player.GetComponent<PlayerController> ().currentObjective == 0) {
player.GetComponent<PlayerController> ().hintBox.SetActive (true);
player.GetComponent<PlayerController> ().hintText.text = "<color=fuchsia>Stella</color>: (...I need to find my crew members and check if they're alright...)";
yield return new WaitUntil (() => Input.GetKeyDown (KeyCode.Return));
yield return new WaitForSeconds (0.2f);
player.GetComponent<PlayerController> ().hintBox.SetActive (false);
player.GetComponent<PlayerController> ().activeHint = false;
player.GetComponent<PlayerController> ().activeTab = false;
player.GetComponent<PlayerController> ().canMove = true;
player.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
StopCoroutine("commsDoorOpen");
}
else if (player.GetComponent<PlayerController> ().currentObjective == 1) {
player.GetComponent<PlayerController> ().hintBox.SetActive (true);
player.GetComponent<PlayerController> ().playerAnimator.Play ("StellaDiscomfort");
player.GetComponent<PlayerController> ().hintText.text = "<color=fuchsia>Stella</color>: Damn it! It's locked!";
yield return new WaitUntil (() => Input.GetKeyDown (KeyCode.Return));
player.GetComponent<PlayerController> ().hintBox.SetActive (false);
yield return new WaitForSeconds (1.5f);
player.GetComponent<PlayerController> ().hintBox.SetActive (true);
player.GetComponent<PlayerController> ().playerAnimator.Play ("StellaStand");
player.GetComponent<PlayerController> ().hintText.text = "<color=fuchsia>Stella</color>: Right, now I remember...the door won't open under emergency lockdown unless I have two omnicards...\n\tI need to search the rooms.";
yield return new WaitUntil (() => Input.GetKeyDown (KeyCode.Return));
yield return new WaitForSeconds (0.2f);
player.GetComponent<PlayerController> ().commsCenterInit = true;
player.GetComponent<PlayerController> ().hintBox.SetActive (false);
player.GetComponent<PlayerController> ().activeHint = false;
player.GetComponent<PlayerController> ().activeTab = false;
player.GetComponent<PlayerController> ().canMove = true;
player.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
StopCoroutine("commsDoorOpen");
}
else if (player.GetComponent<PlayerController> ().currentObjective == 2) {
player.GetComponent<PlayerController> ().hintBox.SetActive (true);
player.GetComponent<PlayerController> ().hintText.text = "<color=fuchsia>Stella</color>: (...I need to search the rooms for two omnicards in order to get into the communications room...)";
yield return new WaitUntil (() => Input.GetKeyDown (KeyCode.Return));
yield return new WaitForSeconds (0.2f);
player.GetComponent<PlayerController> ().hintBox.SetActive (false);
player.GetComponent<PlayerController> ().activeHint = false;
player.GetComponent<PlayerController> ().activeTab = false;
player.GetComponent<PlayerController> ().canMove = true;
player.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
StopCoroutine("commsDoorOpen");
}
else if (player.GetComponent<PlayerController> ().currentObjective == 3) {
swipe.Play ();
yield return new WaitUntil (() => !swipe.isPlaying);
swipe.Play ();
yield return new WaitUntil (() => !swipe.isPlaying);
door.Play ();
yield return new WaitUntil (() => !door.isPlaying);
player.GetComponent<PlayerController> ().canMove = true;
player.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
SceneManager.LoadSceneAsync("Comms Center");
StopCoroutine("commsDoorOpen");
}
else if (player.GetComponent<PlayerController> ().currentObjective == 4) {
player.GetComponent<PlayerController> ().hintBox.SetActive (true);
player.GetComponent<PlayerController> ().hintText.text = "<color=fuchsia>Stella</color>: (...I should try to send my location out using the GPS Tracker in the command center...)";
yield return new WaitUntil (() => Input.GetKeyDown (KeyCode.Return));
yield return new WaitForSeconds (0.2f);
player.GetComponent<PlayerController> ().hintBox.SetActive (false);
player.GetComponent<PlayerController> ().activeHint = false;
player.GetComponent<PlayerController> ().activeTab = false;
player.GetComponent<PlayerController> ().canMove = true;
player.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
StopCoroutine("commsDoorOpen");
}
else if (player.GetComponent<PlayerController> ().currentObjective == 5) {
player.GetComponent<PlayerController> ().hintBox.SetActive (true);
player.GetComponent<PlayerController> ().hintText.text = "<color=fuchsia>Stella</color>: (...I need the repair manual located in the engineering wing in order to find the tools I need...)";
yield return new WaitUntil (() => Input.GetKeyDown (KeyCode.Return));
yield return new WaitForSeconds (0.2f);
player.GetComponent<PlayerController> ().hintBox.SetActive (false);
player.GetComponent<PlayerController> ().activeHint = false;
player.GetComponent<PlayerController> ().activeTab = false;
player.GetComponent<PlayerController> ().canMove = true;
player.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
StopCoroutine("commsDoorOpen");
}
else if (player.GetComponent<PlayerController> ().currentObjective == 10) {
player.GetComponent<PlayerController> ().currentObjective = 11;
door.Play ();
yield return new WaitUntil (() => !door.isPlaying);
player.GetComponent<PlayerController> ().canMove = true;
player.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
SceneManager.LoadSceneAsync("Comms Center");
StopCoroutine("commsDoorOpen");
}
}
}