diff --git a/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs b/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs new file mode 100644 index 0000000..80827a0 --- /dev/null +++ b/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs @@ -0,0 +1,61 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class LighthouseLanding : MonoBehaviour +{ + public bool switchedOff = false; + + private bool isTriggering = false; + + void Awake() + { + NotificationServer.register("statechange Searchlight", searchlightStateChanged); + } + + void OnTriggerEnter(Collider other) + { + if (switchedOff) + return; + if (other.tag != "Player") + return; + if (Searchlight.state == Searchlight.SearchState.Chasing) + return; + if (isTriggering) + return; + + isTriggering = true; + NotificationServer.notify("show TakeoverButton"); + } + + void OnTriggerExit(Collider other) + { + if (switchedOff) + return; + if (other.tag != "Player") + return; + if (!isTriggering) + return; + + isTriggering = false; + NotificationServer.notify("hide TakeoverButton"); + } + + void searchlightStateChanged() + { + if (switchedOff) + return; + if (isTriggering && Searchlight.state == Searchlight.SearchState.Chasing) + { + isTriggering = false; + NotificationServer.notify("hide TakeoverButton"); + } + } + + public void switchOff() + { + switchedOff = true; + NotificationServer.notify("hide TakeoverButton"); + NotificationServer.notify("play sfx", "assassination"); + } +} diff --git a/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs.meta b/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs.meta new file mode 100644 index 0000000..8c04dbc --- /dev/null +++ b/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d48154a3b477045e68763f6fc4a168b7 +timeCreated: 1485057688 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity b/IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity index f83363e..a51988c 100644 Binary files a/IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity and b/IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity differ