using System.Collections; using System.Collections.Generic; using UnityEngine; public class VictoryScript : MonoBehaviour { private bool isTriggering = false; void OnTriggerEnter(Collider other) { if (other.tag != "Player") return; if (Searchlight.state == Searchlight.SearchState.Chasing) return; if (isTriggering) return; isTriggering = true; NotificationServer.notify("show VictoryButton"); } void OnTriggerExit(Collider other) { if (other.tag != "Player") return; if (!isTriggering) return; isTriggering = false; NotificationServer.notify("hide VictoryButton"); } void searchlightStateChanged() { if (isTriggering && Searchlight.state == Searchlight.SearchState.Chasing) { isTriggering = false; NotificationServer.notify("hide VictoryButton"); } } public void victoryClicked() { NotificationServer.notify("fade bgm"); NotificationServer.notify("play sfx", "shipSpotted_2:0.5"); NotificationServer.notify("show VictoryPanel"); NotificationServer.notify("hide GameUI"); } }