-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPillarToLight.cs
More file actions
65 lines (60 loc) · 2.14 KB
/
Copy pathPillarToLight.cs
File metadata and controls
65 lines (60 loc) · 2.14 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
using UnityEngine;
public class PillarToLight : MonoBehaviour
{
//
public GameObject IsThisKeyboardPortMode;
//
private ParticleSystem lightParticle;
public LanternScript lanternScriptRef;
public GameObject doorToOpen;
private bool customIsThisPillarLit = false;
private int fuelNeededToLightPillar = 10;
//
public bool fuelNeededOverride = false;
//
private void Start()
{
if (IsThisKeyboardPortMode.activeSelf == true)
{
lanternScriptRef = IsThisKeyboardPortMode.transform.GetChild(0).GetChild(1).gameObject.GetComponent<LanternScript>();
}
lightParticle = this.gameObject.GetComponent<ParticleSystem>();
doorToOpen.GetComponent<LockedDoor>().AddToTotalLightPillarCount();
}
public bool GetPillarLitBool()
{
return customIsThisPillarLit;
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Lantern"))
{
if (customIsThisPillarLit == false)
{
if (lanternScriptRef.GetLightEnabledState())
{
if (!fuelNeededOverride)
{
if (lanternScriptRef.GetFuel() >= fuelNeededToLightPillar)
{
customIsThisPillarLit = true;
if (!lightParticle.isPlaying) lightParticle.Play();
doorToOpen.GetComponent<LockedDoor>().AddToLitLanternCount();
//
lanternScriptRef.AddFuelToLantern((-fuelNeededToLightPillar + 2));
}
else
{
print("Not enough fuel to light pillar!");
}
}
else
{
customIsThisPillarLit = true;
doorToOpen.GetComponent<LockedDoor>().AddToLitLanternCount();
}
}
}
}
}
}