-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAirLock.cs
46 lines (42 loc) · 1.17 KB
/
AirLock.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
using UnityEngine;
public class AirLock : Machine
{
private StateManager stateManager;
public string ID = "unassigned";
public bool open;
public GameObject openObject;
public GameObject closedObject;
public GameObject effects;
//! Called by unity engine on start up to initialize variables.
public void Start()
{
stateManager = FindObjectOfType<StateManager>();
if (QualitySettings.GetQualityLevel() < 3)
{
effects.SetActive(false);
}
}
//! Called by MachineManager update coroutine.
public override void UpdateMachine()
{
GetComponent<PhysicsHandler>().UpdatePhysics();
}
//! Toggle the open or closed state of the hatchway.
public void ToggleOpen()
{
if (open == false)
{
openObject.SetActive(true);
closedObject.SetActive(false);
GetComponent<Collider>().isTrigger = true;
open = true;
}
else
{
openObject.SetActive(false);
closedObject.SetActive(true);
GetComponent<Collider>().isTrigger = false;
open = false;
}
}
}