Files
vrc-measuregeneric-world/Assets/measuregeneric/scripts/Autoportal.cs
2024-11-28 04:14:23 +05:00

42 lines
879 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Autoportal : MonoBehaviour
{
private List<GameObject> imposters;
private OcclusionPortal portal;
void Start()
{
this.portal = this.GetComponent<OcclusionPortal>();
this.imposters = new List<GameObject>();
foreach(Transform child in this.transform)
{
this.imposters.Add(child.gameObject);
}
}
private void OnTriggerEnter(Collider other)
{
this.portal.open = true;
foreach(GameObject imposter in this.imposters)
{
imposter.SetActive(false);
}
}
private void OnTriggerExit(Collider other)
{
this.portal.open = false;
foreach(GameObject imposter in this.imposters)
{
imposter.SetActive(true);
}
}
}