Tanoda
DanaLedManager.cs
Go to the documentation of this file.
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using UnityEngine;
5using GILES;
6
7public class DanaLedManager : pb_MonoBehaviourSingleton<DanaLedManager>
8{
9 public GameObject[] leds;
10 public Material Normal, Green;
11 private List<int> isOn = new List<int>();
12
13 public void SetLedGreenStayOn(int index) //promo feature
14 {
15 if (index == -1) return;
16 try
17 {
18 leds[index].GetComponent<MeshRenderer>().material = Green;
19 isOn.Add(index);
20 }
21 catch (IndexOutOfRangeException)
22 {
23 Debug.Log("Invalid index: " + index);
24 }
25 //if (isOn.Count >= 6) //hót fölösleges, az első SetLedGreen úgy is kikapcsolja a többit //esetleg lehet event belőle
26 //{
27 // SetAllLedOff();
28 // isOn.Clear();
29 //}
30 }
31
32 public void SetLedGreen(int index)
33 {
35 if (index == -1) return;
36 try
37 {
38 leds[index].GetComponent<MeshRenderer>().material = Green;
40 //if (index == 2)
41 //{
42 // leds[index].GetComponent<MeshRenderer>().material = Normal;
43 // StartCoroutine(prepromocheat());
44 //}
45 //if (index == 5)
46 //{
47 // GameObject.Find("fake_csavarozas (2)").GetComponent<BoxCollider>().enabled = true;
48 // GameObject.Find("fake_csavarozas (3)").GetComponent<BoxCollider>().enabled = true;
49 // GameObject.Find("fake_csavarozas (2)").GetComponent<ReferenceSaver>().Reference.SetActive(true);
50 // GameObject.Find("fake_csavarozas (3)").GetComponent<ReferenceSaver>().Reference.SetActive(true);
51 // GameObject.Find("screwdriver").GetComponent<ReferenceSaver>().Reference.SetActive(true);
52 // leds[index].GetComponent<MeshRenderer>().material = Normal;
53 // StartCoroutine(promocheat());
54 //}
56 }
57 catch (IndexOutOfRangeException)
58 {
59 Debug.Log("Invalid index: " + index);
60 }
61 }
62
63 private IEnumerator promocheat()
64 {
65 while (GameObject.Find("fake_csavarozas (2)") || GameObject.Find("fake_csavarozas (3)"))
66 {
67 yield return new WaitForEndOfFrame();
68 }
69 leds[5].GetComponent<MeshRenderer>().material = Green;
70 }
71 private IEnumerator prepromocheat()
72 {
73 while (GameObject.Find("fake_csavarozas") || GameObject.Find("fake_csavarozas (1)"))
74 {
75 yield return new WaitForEndOfFrame();
76 }
77 leds[2].GetComponent<MeshRenderer>().material = Green;
78 }
79
80 public void SetAllLedOff()
81 {
82 foreach (var led in leds)
83 {
84 led.GetComponent<MeshRenderer>().material = Normal;
85 }
86 }
87}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19
void SetLedGreenStayOn(int index)
void SetLedGreen(int index)
GameObject[] leds