OneButton.cs 1.18 KB
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);
        }
    }




}