You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
1.2 KiB

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