OneButton.cs
1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OneButton : MonoBehaviour
{
public List<Collider> TriggerList= new List<Collider>();
void Start()
{
//화면비율에 따른 위치조정정도?
}
public void ClickEvent()
{
//터치 이벤트 발생시... 이거 가끔 안되는데 왜그러는지..?
//소리, 빛무리
if (TriggerList.Count != 0)
{
//해당순간에 충돌해있는 물체 Queue 중 가장 처음것 삭제이벤트 (원노트의 함수!)
Collider other = TriggerList[TriggerList.Count - 1];
Debug.Log(Time.time + " : TOUCHED COLLIDER'S NAME" + other.name);
other.GetComponent<OneNote>().TouchOccur();
TriggerList.Remove(other);
}
}
void OnTriggerEnter(Collider other)
{
if (!TriggerList.Contains(other))
{
TriggerList.Add(other);
}
}
//called when something exits the trigger
void OnTriggerExit(Collider other)
{
if (TriggerList.Contains(other))
{
TriggerList.Remove(other);
}
}
}