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.
 
 
 
 
 
 

57 lines
1.2 KiB

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");
NotificationServer.register("restart scene", restartScene);
}
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("hide VictoryButton");
NotificationServer.notify("switch off", null);
NotificationServer.notify("fade bgm");
NotificationServer.notify("play sfx", "shipSpotted_2:0.5");
NotificationServer.notify("show VictoryPanel");
NotificationServer.notify("hide GameUI");
}
public void restartScene()
{
isTriggering = false;
}
}