Tanoda
SeegerHelper.cs
Go to the documentation of this file.
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using GILES;
5using UnityEngine;
6
7public class SeegerHelper : MonoBehaviour
8{
9 public bool HasRing = false;
10 public GameObject seegerRing;
11 public static SeegerHelper instance;
12
13 private void Awake()
14 {
15 if (!instance)
16 instance = this;
17 else
18 Destroy(this);
19 }
20
21 public bool Trigger()
22 {
23 if (HasRing)
24 {
25 HasRing = false;
26 seegerRing?.SetActive(false);
27 return true;
28 }
29
30 return false;
31 }
32
33 void OnTriggerEnter(Collider other)
34 {
35 if (HasRing)
36 {
37 return;
38 }
39 try
40 {
41#if !UNITY_WEBGL
42 if (other.name.Contains("seeger") && !other.name.Contains("seeger_plier"))
43 {
44 var tcd = other.gameObject.GetComponentInParent<ThrowableCanDisable>();
45 if (tcd)
46 {
47 tcd.ForceDrop();
48 Destroy(tcd.gameObject);
49 HasRing = true;
50 seegerRing?.SetActive(true);
51 }
52 }
53#endif
54 }
55 catch (Exception)
56 {
57 // ignored
58 }
59 }
60}
static SeegerHelper instance
Definition: SeegerHelper.cs:11
GameObject seegerRing
Definition: SeegerHelper.cs:10
bool Trigger()
Definition: SeegerHelper.cs:21