1
0
mirror of synced 2024-12-03 18:27:16 +01:00
WACVR/Assets/Script/TouchManager/ColliderToTouch.cs
xpeng d23ae3be82 il2cpp transition (this commit is still in mono)
fix ipc touch not working under il2cpp;
fix bat wont start under il2cpp;
2022-11-08 23:43:35 +01:00

35 lines
892 B
C#

using UnityEngine;
using System.IO.Ports;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
public class ColliderToTouch : MonoBehaviour
{
public LightManager LightManager;
private int _insideColliderCount = 0;
private int Area;
private void Start()
{
Area = Convert.ToInt32(gameObject.name);
}
private void OnTriggerEnter(Collider collider)
{
_insideColliderCount += 1;
TouchManager.SetTouch(Area, true);
LightManager.UpdateFadeLight(Area, true);
}
private void OnTriggerExit(Collider collider)
{
_insideColliderCount -= 1;
_insideColliderCount = Mathf.Max(0, _insideColliderCount);
if (_insideColliderCount == 0)
{
TouchManager.SetTouch(Area, false);
LightManager.UpdateFadeLight(Area, false);
}
}
}