|
|
@ -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"); |
|
|
|
} |
|
|
|
} |