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.

51 lines
1.1 KiB

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class VictoryScript : MonoBehaviour
  5. {
  6. private bool isTriggering = false;
  7. void OnTriggerEnter(Collider other)
  8. {
  9. if (other.tag != "Player")
  10. return;
  11. if (Searchlight.state == Searchlight.SearchState.Chasing)
  12. return;
  13. if (isTriggering)
  14. return;
  15. isTriggering = true;
  16. NotificationServer.notify("show VictoryButton");
  17. }
  18. void OnTriggerExit(Collider other)
  19. {
  20. if (other.tag != "Player")
  21. return;
  22. if (!isTriggering)
  23. return;
  24. isTriggering = false;
  25. NotificationServer.notify("hide VictoryButton");
  26. }
  27. void searchlightStateChanged()
  28. {
  29. if (isTriggering && Searchlight.state == Searchlight.SearchState.Chasing)
  30. {
  31. isTriggering = false;
  32. NotificationServer.notify("hide VictoryButton");
  33. }
  34. }
  35. public void victoryClicked()
  36. {
  37. NotificationServer.notify("hide VictoryButton");
  38. NotificationServer.notify("switch off", null);
  39. NotificationServer.notify("fade bgm");
  40. NotificationServer.notify("play sfx", "shipSpotted_2:0.5");
  41. NotificationServer.notify("show VictoryPanel");
  42. NotificationServer.notify("hide GameUI");
  43. }
  44. }