1
0
mirror of synced 2024-12-19 17:55:54 +01:00
WACVR/Assets/Script/TouchManager/ColliderToTouch.cs
xpeng da11ac7abc fix only can select capture desktop; small improvements
Add Touch Panel Air Wall
Add Light Strength Slider
Fix some config panel slider issues
Add .blend file for cab
Fix small shader issue
2022-11-07 22:31:18 +01:00

38 lines
1011 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;
public static event Action touchDidChange;
private int Area;
private void Start()
{
Area = Convert.ToInt32(gameObject.name);
}
private void OnTriggerEnter(Collider collider)
{
_insideColliderCount += 1;
TouchManager.SetTouch(Area, true);
touchDidChange?.Invoke();
LightManager.UpdateFadeLight(Area, true);
}
private void OnTriggerExit(Collider collider)
{
_insideColliderCount -= 1;
_insideColliderCount = Mathf.Max(0, _insideColliderCount);
if (_insideColliderCount == 0)
{
TouchManager.SetTouch(Area, false);
touchDidChange?.Invoke();
LightManager.UpdateFadeLight(Area, false);
}
}
}