Tanoda
CheckPlacement.cs
Go to the documentation of this file.
1using System.Collections;
2using System.Collections.Generic;
3using UnityEngine;
4
5public class CheckPlacement : MonoBehaviour
6{
7 public bool Good = true;
8
9 private void OnTriggerEnter(Collider other)
10 {
11#if !UNITY_WEBGL
12 if (other && other.GetComponentInParent<ReferenceSaver>() && !other.GetComponent<HackedHand>())
13 {
14 var rs = other.GetComponentInParent<ReferenceSaver>();
15 if (rs.Reference == ConveyorBeltManager.instance.SpawnGood && Good)
16 {
17 SavedUser.instance.loopCount++;
18 if (SavedUser.instance.loopCount >= ConveyorBeltManager.instance.repeatTimes)
19 {
20 SavedUser.instance.LevelFinished(true, -1, HandStatistics.instance.GetPercent());
21
22 ReplayLogic.instance.StageStarted = false;
23 HandStatistics.instance.StopCollecting();
24 var allFinish2 = FindObjectsOfType<FinishAction>();
25 foreach (var fa in allFinish2) fa.IsCounting = false;
26 SavedUser.instance.loopCount = 0;
27 }
28 Debug.Log("CheckPlacement: OK!");
29 Destroy(rs.gameObject);
30 var hands = Valve.VR.InteractionSystem.Player.instance.hands;
31 foreach (var h in hands)
32 {
33 if (h is HackedHand hh)
34 {
35 hh.ForceDrop();
36 }
37 }
38 }
39 else
40 {
41 if (rs.Reference != ConveyorBeltManager.instance.SpawnGood && !Good)
42 {
43 Debug.Log("CheckPlacement: OK!");
44 Destroy(rs.gameObject);
45
46 var hands = Valve.VR.InteractionSystem.Player.instance.hands;
47 foreach (var h in hands)
48 {
49 if (h is HackedHand hh)
50 {
51 hh.ForceDrop();
52 }
53 }
54 }
55 else
56 {
57 Debug.Log("CheckPlacement: Fail!");
58 MiscLogicManager.instance.LevelFailed(Time.time);
59 }
60 }
61 }
62#endif
63 }
64}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19